UNPKG

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