ConstReadonlyauth: {Readonlyforbidden: (reason?: string) => AuthorizationErrorGeneric forbidden
ReadonlyinsufficientScope: (required: string[], actual: string[]) => AuthorizationErrorToken lacks required scopes
ReadonlyinvalidToken: (reason?: string) => AuthenticationErrorToken is invalid or malformed
ReadonlymissingToken: () => AuthenticationErrorNo token provided
ReadonlytokenExpired: () => AuthenticationErrorToken has expired
Readonlyunauthorized: (message: string) => AuthenticationErrorCustom authentication error
Readonlycancellation: {Readonlycustom: (message: string, requestId?: string | number) => OperationCancelledErrorCreate a custom cancellation error
ReadonlyfromAbortSignal: (signal: AbortSignal, requestId?: string | number) => OperationCancelledErrorCreate from an AbortSignal
ReadonlyfromRequest: (requestId: string | number, reason?: string) => OperationCancelledErrorCreate from a cancelled request
Readonlyconfiguration: {ReadonlyconstraintViolation: (message: string, fields: string[]) => ConfigurationErrorCross-field constraint violation
Readonlycustom: (message: string, configKey?: string) => ConfigurationErrorCreate a custom configuration error
ReadonlyfileNotFound: (filePath: string) => ConfigurationErrorConfig file not found (explicit MCP_CONFIG_FILE path)
ReadonlyfileParseFailed: (filePath: string, cause?: Error) => ConfigurationErrorConfig file TOML/YAML parse failure
ReadonlyfileReadFailed: (filePath: string, cause?: Error) => ConfigurationErrorConfig file could not be read
ReadonlyfileValidationFailed: (filePath: string, zodError: ZodError) => ConfigurationErrorConfig file schema validation failed (typos, wrong types)
Readonlyinvalid: (message: string) => ConfigurationErrorCreate an invalid configuration error
ReadonlyinvalidEnvVar: (varName: string, reason: string) => ConfigurationErrorCreate an invalid env var error
ReadonlymissingEnvVar: (varName: string) => ConfigurationErrorCreate a missing env var error
ReadonlyunsupportedFormat: (extension: string) => ConfigurationErrorUnsupported config file extension
Readonlyconnection: {Readonlycustom: (message: string, target: string) => ConnectionErrorCreate a custom connection error
Readonlyfailed: (target: string, reason?: string) => ConnectionErrorCreate a generic connection failed error
ReadonlyhealthCheckFailed: (reason: string, target?: string) => ConnectionErrorCreate a health check failed error
Readonlylost: (target: string) => ConnectionErrorCreate a connection lost error
Readonlyrefused: (target: string) => ConnectionErrorCreate a connection refused error
Readonlyreset: (target: string) => ConnectionErrorCreate a connection reset error
Readonlytimeout: (target: string, timeoutMs?: number) => ConnectionErrorCreate a connection timeout error
Readonlyinternal: {Readonlycustom: (message: string) => InternalErrorCreate a custom internal error
ReadonlynotImplemented: (feature: string) => InternalErrorCreate a not implemented error
ReadonlyunexpectedState: (description: string) => InternalErrorCreate an unexpected state error
Readonlywrap: (error: unknown, context?: string) => InternalErrorWrap an unknown error
ReadonlyisAppError: (error: unknown) => error is AppErrorCheck if an error is an AppError (framework or app error)
Readonlymcp: {Readonlycustom: (message: string, code?: number) => McpProtocolErrorCreate a custom MCP error
ReadonlyinvalidParams: (reason: string) => McpProtocolErrorCreate an invalid params error
ReadonlyinvalidRequest: (reason: string) => McpProtocolErrorCreate an invalid request error
ReadonlymethodNotFound: (method: string) => McpProtocolErrorCreate a method not found error
ReadonlyparseError: (reason: string) => McpProtocolErrorCreate a parse error
Readonlynormalize: (error: unknown, fallbackMessage?: string) => AppErrorNormalize any error to an AppError
Readonlyoperation: {Readonlycustom: (message: string, operation?: string) => OperationErrorCreate a custom operation error
Readonlyfailed: (operation: string, reason?: string) => OperationErrorCreate a failed operation error
Readonlytimeout: (operation: string, timeoutMs: number) => OperationErrorCreate a timeout error
Readonlyunavailable: (operation: string) => OperationErrorCreate an unavailable error
Readonlyregistry: {ReadonlyduplicatePrompt: (name: string) => RegistryErrorDuplicate prompt
ReadonlyduplicateResource: (name: string) => RegistryErrorDuplicate resource
ReadonlyduplicateTool: (name: string) => RegistryErrorDuplicate tool
ReadonlypromptNotFound: (name: string) => RegistryErrorPrompt not found
ReadonlyresourceNotFound: (name: string) => RegistryErrorResource not found
ReadonlytoolNotFound: (name: string) => RegistryErrorTool not found
Readonlysession: {Readonlycustom: (message: string, sessionId?: string) => SessionErrorCreate a custom session error
Readonlyexpired: (sessionId: string) => SessionErrorCreate a session expired error
ReadonlyinvalidState: (sessionId: string, currentState: string, expectedState: string) => SessionErrorCreate an invalid session state error
ReadonlylimitReached: (maxSessions: number) => SessionErrorCreate a session limit reached error
ReadonlynotFound: (sessionId: string) => SessionErrorCreate a session not found error
Readonlytransport: {ReadonlyconnectionClosed: (reason?: string) => TransportErrorCreate a connection closed error
ReadonlyconnectionFailed: (reason: string) => TransportErrorCreate a connection failed error
Readonlycustom: (message: string, transportType?: "http" | "sse" | "stdio") => TransportErrorCreate a custom transport error
ReadonlydnsRebinding: (host: string) => TransportErrorCreate a DNS rebinding error
ReadonlyinvalidHeader: (header: string, reason: string) => TransportErrorCreate an invalid header error
ReadonlyportInUse: (bind: string) => TransportErrorCreate a port-in-use error
ReadonlyprivilegesRequired: (bind: string) => TransportErrorCreate a privileges-required error
ReadonlyprotocolMismatch: (expected: string, received: string) => TransportErrorCreate a protocol mismatch error
ReadonlyrateLimited: (retryAfterSeconds?: number) => TransportErrorCreate a rate limited error
Readonlyvalidation: {Readonlycustom: (message: string, field?: string) => ValidationErrorCreate a custom validation error
ReadonlyfieldInvalid: (field: string, value?: unknown) => ValidationErrorCreate a field invalid error
ReadonlyfieldMax: (field: string, max: number) => ValidationErrorCreate a max constraint error
ReadonlyfieldMin: (field: string, min: number) => ValidationErrorCreate a min constraint error
ReadonlyfieldPattern: (field: string) => ValidationErrorCreate a pattern mismatch error
ReadonlyfieldRequired: (field: string) => ValidationErrorCreate a field required error
ReadonlyfieldTypeMismatch: (field: string, expectedType: string) => ValidationErrorCreate a type mismatch error
ReadonlyfromZodError: (error: ZodError, message?: string) => ValidationErrorCreate from a Zod error
// MCP errors
throw FrameworkErrorFactory.mcp.invalidRequest('Missing params');
throw FrameworkErrorFactory.session.expired('sess-123');
// Validation errors
throw FrameworkErrorFactory.validation.fromZodError(zodError);
throw FrameworkErrorFactory.validation.fieldRequired('name');
// Operation errors
throw FrameworkErrorFactory.operation.failed('deploy', 'timeout');
Framework Error Factory
Provides static methods for creating framework-level errors. This factory is generic and can be extended by application code.