Function: defineErrorHandler()
Function: defineErrorHandler()
Registers a kernel-level error handler in the blueprint.
This utility defines a structured error handler (function, factory, or class) for one or more error types, and adds it to the stone.kernel.errorHandlers
blueprint section.
Param
The error handler module (function, factory, or class).
Param
Metadata defining the error types it handles, and type flags.
Call Signature
function defineErrorHandler<U, V>(module, options): Partial<StoneBlueprint<U>>;
Defines a function-based error handler.
Type Parameters
U
U
extends IncomingEvent
= IncomingEvent
V
V
= OutgoingResponse
Parameters
module
FunctionalErrorHandler
<U
, V
>
The error handler function.
options
ErrorHandlerOptions
& object
The error types and metadata.
Returns
Partial
<StoneBlueprint
<U
>>
A partial StoneBlueprint with the error handler(s) registered.
Param
The error handler module (function, factory, or class).
Param
Metadata defining the error types it handles, and type flags.
Call Signature
function defineErrorHandler<U, V>(module, options): Partial<StoneBlueprint<U>>;
Defines a factory-based error handler.
Type Parameters
U
U
extends IncomingEvent
= IncomingEvent
V
V
= OutgoingResponse
Parameters
module
FactoryErrorHandler
<U
, V
>
The factory function that returns an error handler.
options
ErrorHandlerOptions
& object
The error types and metadata.
Returns
Partial
<StoneBlueprint
<U
>>
A partial StoneBlueprint with the error handler(s) registered.
Param
The error handler module (function, factory, or class).
Param
Metadata defining the error types it handles, and type flags.
Call Signature
function defineErrorHandler<U, V>(module, options): Partial<StoneBlueprint<U>>;
Defines a class-based error handler.
Type Parameters
U
U
extends IncomingEvent
= IncomingEvent
V
V
= OutgoingResponse
Parameters
module
IErrorHandlerClass
<U
, V
>
The error handler class.
options
ErrorHandlerOptions
& object
The error types and metadata.
Returns
Partial
<StoneBlueprint
<U
>>
A partial StoneBlueprint with the error handler(s) registered.
Param
The error handler module (function, factory, or class).
Param
Metadata defining the error types it handles, and type flags.