A catch-everything filter in NestJS is an exception filter declared with @Catch() (empty parameter list) that handles all unhandled exceptions regardless of type. It uses HttpAdapterHost for platform-agnostic response delivery:
@Catch()
export class CatchEverythingFilter implements ExceptionFilter {
constructor(private readonly httpAdapterHost: HttpAdapterHost) {}
catch(exception: unknown, host: ArgumentsHost) {
const { httpAdapter } = this.httpAdapterHost;
const ctx = host.switchToHttp();
const status = exception instanceof HttpException
? exception.getStatus()
: HttpStatus.INTERNAL_SERVER_ERROR;
httpAdapter.reply(ctx.getResponse(), { statusCode: status, ... }, status);
}
}When combining with type-specific filters, the catch-everything filter must be declared first to let specific filters handle their bound types correctly.