1 | /**
|
2 | * Defines the base Nest HTTP exception, which is handled by the default
|
3 | * Exceptions Handler.
|
4 | *
|
5 | * @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
|
6 | *
|
7 | * @publicApi
|
8 | */
|
9 | export declare class HttpException extends Error {
|
10 | private readonly response;
|
11 | private readonly status;
|
12 | readonly message: any;
|
13 | /**
|
14 | * Instantiate a plain HTTP Exception.
|
15 | *
|
16 | * @example
|
17 | * `throw new HttpException()`
|
18 | *
|
19 | * @usageNotes
|
20 | * The constructor arguments define the HTTP response.
|
21 | * - The `response` argument (required) defines the JSON response body.
|
22 | * - The `status` argument (required) defines the HTTP Status Code.
|
23 | *
|
24 | * By default, the JSON response body contains two properties:
|
25 | * - `statusCode`: defaults to the Http Status Code provided in the `error` argument
|
26 | * - `message`: a short description of the HTTP error by default; override this
|
27 | * by supplying a string in the `response` parameter.
|
28 | *
|
29 | * To override the entire JSON response body, pass an object. Nest will serialize
|
30 | * the object and return it as the JSON response body.
|
31 | *
|
32 | * The `status` argument is required, and should be a valid HTTP status code.
|
33 | * Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
|
34 | *
|
35 | * @param response string or object describing the error condition.
|
36 | * @param status HTTP response status code
|
37 | */
|
38 | constructor(response: string | object, status: number);
|
39 | getResponse(): string | object;
|
40 | getStatus(): number;
|
41 | toString(): string;
|
42 | private getErrorString;
|
43 | static createBody(message: object | string, error?: string, statusCode?: number): object;
|
44 | }
|