surmon-china / nodepress

🟢 RESTful API service for https://surmon.me blog, powered by @nestjs

Home Page:https://github.surmon.me/nodepress

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

全局异常过滤器报错

Sjhb opened this issue · comments

@Catch()
export class HttpExceptionFilter implements ExceptionFilter {
  // ...
  const status = exception.getStatus() || HttpStatus.INTERNAL_SERVER_ERROR;
  // ...
}

这里@catch()是否应该改为@catch(HttpException)

其它类型的异常对象可能没有getStatus方法,从而导致全局过滤器报错。