@types/errorhandler
TypeScript icon, indicating that this package has built-in type declarations

1.5.3 • Public • Published

Installation

npm install --save @types/errorhandler

Summary

This package contains type definitions for errorhandler (https://github.com/expressjs/errorhandler).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/errorhandler.

import express = require("express");

/**
 * Create new middleware to handle errors and respond with content negotiation.
 */
declare function errorHandler(options?: errorHandler.Options): express.ErrorRequestHandler;

declare namespace errorHandler {
    interface LoggingCallback {
        (err: Error, str: string, req: express.Request, res: express.Response): void;
    }

    interface Options {
        /**
         * Provide a function to be called with the error and a string representation of the erro
         * Defaults to true.
         *
         * Possible values:
         *   true       : Log errors using console.error(str).
         *   false      : Only send the error back in the response.
         *   A function : pass the error to a function for handling.
         */
        log: boolean | LoggingCallback;
    }

    /**
     * Template title, framework authors may override this value.
     */
    const title: string;
}

export = errorHandler;

Additional Details

  • Last updated: Mon, 06 Nov 2023 22:41:05 GMT
  • Dependencies: @types/express

Credits

These definitions were written by Santi Albo, and Piotr Błażejewicz.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/errorhandler

Weekly Downloads

52,243

Version

1.5.3

License

MIT

Unpacked Size

4.83 kB

Total Files

5

Last publish

Collaborators

  • types