Skip to content

API reference / @chanx-js/server / core / ErrorHooks

Interface: ErrorHooks<Ctx> ​

Defined in: packages/server/src/consumer.ts:166

Overrides for how failures reach the client. Each defaults to what chanx does.

Extended by ​

Type Parameters ​

Type Parameter
Ctx

Properties ​

onEventError? ​

ts
optional onEventError?: (error, event, ctx) => void | Promise<void>;

Defined in: packages/server/src/consumer.ts:172

An event handler threw. Default: log it; the client is told nothing.

Parameters ​

ParameterType
errorunknown
eventMessage
ctxCtx

Returns ​

void | Promise<void>


onHandlerError? ​

ts
optional onHandlerError?: (error, message, ctx) => void | Promise<void>;

Defined in: packages/server/src/consumer.ts:170

A message handler threw. Default: log it, and an error frame naming the action.

Parameters ​

ParameterType
errorunknown
messageMessage
ctxCtx

Returns ​

void | Promise<void>


onValidationError? ​

ts
optional onValidationError?: (issues, ctx) => void | Promise<void>;

Defined in: packages/server/src/consumer.ts:168

A frame failed validation. Default: an error frame listing the issues.

Parameters ​

ParameterType
issuesValidationIssue[]
ctxCtx

Returns ​

void | Promise<void>

MIT licensed