Open DM-UOC opened 1 year ago
@DM-UOC What the package?
@Semigradsky @types/express-serve-static-core
import {
ExceptionFilter,
Catch,
ArgumentsHost,
HttpException,
} from '@nestjs/common';
import { Request, Response } from 'express';
@Catch(HttpException)
export class HttpExceptionFilter implements ExceptionFilter {
catch(exception: HttpException, host: ArgumentsHost) {
const ctx = host.switchToHttp();
const response = ctx.getResponse<Response>();
const httpStatus = exception.getStatus();
response.status(httpStatus).json({});
}
}
@ZeroCho what the version of @types/express-serve-static-core
you have?
Status interface give a warning althoug a number is declared. Bisides, gia a message: "Property status does not exist on type Response<string, any>"