UNPKG

1.67 kBTypeScriptView Raw
1import { HttpException } from './http.exception';
2/**
3 * Defines an HTTP exception for *ImATeapotException* type errors.
4 *
5 * Any attempt to brew coffee with a teapot should result in the error code
6 * "418 I'm a teapot". The resulting entity body MAY be short and stout.
7 *
8 * @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
9 *
10 * @publicApi
11 */
12export declare class ImATeapotException extends HttpException {
13 /**
14 * Instantiate an `ImATeapotException` Exception.
15 *
16 * @example
17 * `throw new ImATeapotException()`
18 *
19 * @usageNotes
20 * The HTTP response status code will be 418.
21 * - The `objectOrError` argument defines the JSON response body or the message string.
22 * - The `description` argument contains a short description of the HTTP error.
23 *
24 * By default, the JSON response body contains two properties:
25 * - `statusCode`: this will be the value 418.
26 * - `message`: the string `"I'm a Teapot"` by default; override this by supplying
27 * a string in the `objectOrError` parameter.
28 *
29 * If the parameter `objectOrError` is a string, the response body will contain an
30 * additional property, `error`, with a short description of the HTTP error. To override the
31 * entire JSON response body, pass an object instead. Nest will serialize the object
32 * and return it as the JSON response body.
33 *
34 * @param objectOrError string or object describing the error condition.
35 * @param description a short description of the HTTP error.
36 */
37 constructor(objectOrError?: string | object | any, description?: string);
38}