Skip to main content

ExpressErrorCallbackFunction

ExpressErrorCallbackFunction = (params) => void | Promise<void>

Callback called when an unhandled error is thrown inside an AdminForth API endpoint handler. Useful to report errors to external services (e.g. Sentry) or to do custom logging. Thrown errors / rejections from this callback are caught and logged, they do not affect the response.

Parameters

ParameterTypeDescription
params{ adminforth: IAdminForth; error: any; extra: HttpExtra; }-
params.adminforthIAdminForthAdminforth instance.
params.erroranyThe error thrown by the endpoint handler.
params.extraHttpExtraExtra HTTP information about the request which caused the error.

Returns

void | Promise<void>