@nestjs/core
Version:
The core of NestJS, a TypeScript framework for Node.js backends: modules, dependency injection and the request pipeline, on Express, Fastify or node:http.
32 lines (31 loc) • 1.27 kB
TypeScript
import { type ArgumentsHost, type ExceptionFilter, type HttpServer } from '@nestjs/common';
import { AbstractHttpAdapter } from '../adapters/index.js';
import { HttpAdapterHost } from '../helpers/http-adapter-host.js';
export declare class BaseExceptionFilter<T = any> implements ExceptionFilter<T> {
protected readonly applicationRef?: HttpServer | undefined;
private static readonly logger;
protected readonly httpAdapterHost?: HttpAdapterHost;
constructor(applicationRef?: HttpServer | undefined);
catch(exception: T, host: ArgumentsHost): void;
handleUnknownError(exception: T, host: ArgumentsHost, applicationRef: AbstractHttpAdapter | HttpServer): void;
isExceptionObject(err: any): err is Error;
/**
* Checks if the thrown error is a FastifyError or comes from the "http-errors" library.
* @param err error object
*/
isHttpError(err: any): err is {
statusCode: number;
message: string;
expose?: boolean;
};
/**
* Returns the message of an HTTP error (see `isHttpError()`) that may be
* sent to the client.
* @param err error object
*/
getHttpErrorMessage(err: {
statusCode: number;
message: string;
expose?: boolean;
}): string;
}