@beholdio/ts-lambda-api - v2.4.8
    Preparing search index...

    Class ErrorInterceptorAbstract

    Base class for implementing error interceptors that are invoked to handle errors thrown by endpoints.

    Index

    Constructors

    Properties

    controllerTarget?: string
    endpointTarget?: string

    Methods

    • Error interceptors implement this method to handle errors.

      Parameters

      • apiError: ApiError

        Details of error that was thrown by an endpoint, contains the request and response context, which can used to return a custom HTTP response.

      Returns Promise<any>

      Value that you want to send back in the HTTP response; optional.

    • Should this interceptor handle a given endpoint error?

      Parameters

      • controller: string

        Class name of the controller where the error occurred.

      • endpoint: string

        Name of the endpoint; format is ${ClassName}:${MethodName}.

      Returns boolean

      If this is a global error interceptor, denoted by a endpointTarget that equals "*", return true. Otherwise return whether the endpointTarget or controllerTarget match the controller or endpoint respectively.