Interfaces

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

BaseEvent

interface

Members

  • name: string

View source ↗

Members

  • onEvent(event: T): void | Promise<void>

View source ↗

Deferred by the framework when a handler throws an unexpected exception — one that was not an intentional, client-facing error (HttpError, validation failure), i.e. exactly the errors the framework masks from clients.

Emission rides the deferred-action chain: listeners run after the response is sent (via waitUntil on the request path) and resolve from the event's own scoped container, so a listener can inject repositories or services. Listener failures are logged and never cascade.

On surfaces with platform retry semantics (queue, scheduled) the event fires on every failed attempt — deduplication is the listener's concern.

@EventBusListener(UnhandledExceptionEventName)
export class ErrorPersister
    implements BaseEventListener<UnhandledExceptionEvent>
{
    async onEvent(event: UnhandledExceptionEvent) {
        // log to the database, page someone, ...
    }
}

extends BaseEvent

Members

  • detail: string

    What was executing: the route, RPC procedure, GraphQL operation, queue message type, or scheduled executable name.

  • error: unknown

    The thrown value, unmasked. May be anything throw allows.

  • ipAddress?: string

    The caller's IP address, when the surface has a request (http, rpc, graphql) — so a listener can tell a customer hitting a bug from a crawler probing endpoints. The framework stores nothing; whether to persist caller identity is the listener's choice.

  • name: "Base.UnhandledException"

  • requestId?: string

    The request id, when the surface has one (http, rpc, graphql).

  • surface: UnhandledExceptionSurface

    The dispatch surface the exception escaped from.

  • userAgent?: string

    The caller's User-Agent header, when the surface has a request. Same persistence note as ipAddress.

View source ↗