# Http exceptions

Ts.ED http exceptions provide classes to throw standard HTTP exceptions. Theses exceptions can be used on Controller, Middleware or injectable Service. Emitted exceptions will be handle by the and formatted to an Express response with the right status code and headers.

Other thing. This module can be used with a pure Express application.

# Installation

npm install @tsed/exceptions
// or
yarn add @tsed/exceptions
1
2
3

# Usage

    # Custom exception

    It's possible to create your own exception by creating a class which inherit from or one of the built-in exception like .

    Example:

    import {BadRequest} from "@tsed/exceptions";
    
    export class IDFormatException extends BadRequest {
      constructor() {
        super("ID format is not valid");
      }
    }
    
    1
    2
    3
    4
    5
    6
    7

    # Built-in exceptions

    # Redirections (3xx)

    # Client errors (4xx)

    # Server errors (5xx)