Skip to main content

errorHandler()

Home > @backstage/backend-common > errorHandler

Express middleware to handle errors during request processing.

This is commonly the very last middleware in the chain.

Its primary purpose is not to do translation of business logic exceptions, but rather to be a global catch-all for uncaught "fatal" errors that are expected to result in a 500 error. However, it also does handle some common error types (such as http-error exceptions) and returns the enclosed status code accordingly.

Signature:

function errorHandler(options?: ErrorHandlerOptions): ErrorRequestHandler;

Parameters

ParameterTypeDescription
optionsErrorHandlerOptions(Optional)

Returns:

ErrorRequestHandler

An Express error request handler