Error thrown when server lifecycle operations fail. Use for server start/stop issues, configuration conflicts, etc.
Example
throw new ServerError("Cannot get server when autoStart is true");
throw new ServerError("Server not started");
Extends
Constructors
Constructor
new ServerError(message: string, options?: {
cause?: Error;
context?: Record<string, unknown>;
}): ServerError;
Parameters
| Parameter | Type |
|---|---|
message | string |
options? | { cause?: Error; context?: Record<string, unknown>; } |
options.cause? | Error |
options.context? | Record<string, unknown> |
Returns
ServerError
Inherited from
Properties
cause?
readonly optional cause: Error;
Optional cause of the error
Inherited from
code
readonly code: "SERVER_ERROR" = "SERVER_ERROR";
Error code for programmatic error handling
Overrides
context?
readonly optional context: Record<string, unknown>;
Additional context for the error
Inherited from
isRetryable
readonly isRetryable: false = false;
Whether this error type is generally safe to retry
Overrides
statusCode
readonly statusCode: 500 = 500;
HTTP status code suggestion (can be overridden)
Overrides
Methods
toJSON()
toJSON(): Record<string, unknown>;
Convert error to JSON for logging/serialization. Sensitive values in context are automatically redacted.
Returns
Record<string, unknown>
Inherited from
toString()
Create a human-readable string representation
Returns
string
Inherited from
autoStartConflict()
static autoStartConflict(operation: string): ServerError;
Create a server error for autoStart conflict
Parameters
| Parameter | Type |
|---|---|
operation | string |
Returns
ServerError
clientDirectoryNotFound()
static clientDirectoryNotFound(searchedPaths: string[]): ServerError;
Create a server error for missing client directory
Parameters
| Parameter | Type |
|---|---|
searchedPaths | string[] |
Returns
ServerError
notStarted()
static notStarted(): ServerError;
Create a server error for server not started
Returns
ServerError
viteNotInitialized()
static viteNotInitialized(): ServerError;
Create a server error for Vite dev server not initialized
Returns
ServerError