Nestjs Dto validation error returns JSON response but I want to render and pass validation errors to ejs file when validation fails
Why not catch the exception in an exception filter and then call res.render() with the file you want to render and metadata for the file?
@Catch(BadRequestException)
export class BadRequestFilter implements ExceptionFilter {
catch(exception: BadRequestException, host: ArgumentHost) {
const res = host.switchToHttp().getResponse();
res.render('error', { errorInfo: exception });
}
}