Types

@system-inc/base-foundation · 515c140 · 3 symbols

BaseErrorOptions: unknown

Members

  • cause?: unknown

    The underlying cause of the error.

  • errorCode?: string

    Application-specific error code for programmatic error handling.

  • extensions?: Readonly<JsonObject>

    Any additional information related to the error.

  • name?: string

    The name of the error type.

  • stack?: string

    The stack trace of the error.

  • statusCode?: number

    The HTTP status code associated with the error.

View source ↗

Framework-level error codes. Modules and applications extend this by unioning in their own error code types:

// Pull module error codes
type MyCodes = ErrorCode | AccountErrorCode | AccessLogErrorCode;

// Or add application-specific ones
type MyAppErrors = ErrorCode | 'CUSTOM_ERROR' | 'BACKEND_ERROR';

// Use with HttpErrors
HttpErrors.badRequest<MyCodes>({ errorCode: 'CUSTOM_ERROR' });

Designed to be tree-shakeable — only imported error code constants are included in the final bundle.

ErrorCode: typeof ERROR_CODE_VALIDATION_ERROR | typeof ERROR_CODE_SERIALIZATION_ERROR | typeof ERROR_CODE_INVALID_TYPE | typeof ERROR_CODE_QUOTA_EXCEEDED | typeof ERROR_CODE_NOT_FOUND | typeof ERROR_CODE_ALREADY_EXISTS | typeof ERROR_CODE_AUTHENTICATION_REQUIRED | typeof ERROR_CODE_PERMISSION_DENIED | typeof ERROR_CODE_INSUFFICIENT_ENTITLEMENTS

View source ↗

A JSON-serializable representation of a single validation failure.

Mirrors the framework's runtime @base/foundation/validation/ValidationError | ValidationError in wire-friendly form: flat, path-addressed, with a map of failed rule names to messages.

ValidationErrorData: StrictJsonInterface<{ constraints: { [rule: string]: string }; path: string }>

View source ↗