Class: InitializationError | AppKit
Error thrown when a service or component is not properly initialized. Use when accessing services before they are ready.
Example
throw new InitializationError("CacheManager not initialized");
throw new InitializationError("ServiceContext not initialized. Call ServiceContext.initialize() first.");
Extends
Constructors
Constructor
new InitializationError(message: string, options?: {
cause?: Error;
context?: Record<string, unknown>;
}): InitializationError;
Parameters
| Parameter | Type |
|---|---|
message | string |
options? | { cause?: Error; context?: Record<string, unknown>; } |
options.cause? | Error |
options.context? | Record<string, unknown> |
Returns
InitializationError
Inherited from
Properties
cause?
readonly optional cause: Error;
Optional cause of the error
Inherited from
code
readonly code: "INITIALIZATION_ERROR" = "INITIALIZATION_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: true = true;
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
migrationFailed()
static migrationFailed(cause?: Error): InitializationError;
Create an initialization error for migration failure
Parameters
| Parameter | Type |
|---|---|
cause? | Error |
Returns
InitializationError
notInitialized()
static notInitialized(serviceName: string, hint?: string): InitializationError;
Create an initialization error for a service that is not ready
Parameters
| Parameter | Type |
|---|---|
serviceName | string |
hint? | string |
Returns
InitializationError
setupFailed()
static setupFailed(component: string, cause?: Error): InitializationError;
Create an initialization error for setup failure
Parameters
| Parameter | Type |
|---|---|
component | string |
cause? | Error |
Returns
InitializationError