We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
你好,从你的开源代码中学到很多,非常感谢!
数据流异常拦截器按照 README 的描述是:当控制器所需的 Promise service 发生错误时,错误将在此被捕获
README
有两个个疑问:
CustomException
HttpExceptionFilter
exception
throwError(new CustomException({ message, error }, statusCode));
我在生产环境中并没有关闭 NestJS 的 Logger,所以我在 HttpExceptionFilter 中多加了些打印日志
NestJS
Logger
Logger.error( `${request.method} ${request.url}`, JSON.stringify(errorResponse), 'HttpExceptionFilter', );
The text was updated successfully, but these errors were encountered:
No branches or pull requests
你好,从你的开源代码中学到很多,非常感谢!
数据流异常拦截器按照
README
的描述是:当控制器所需的 Promise service 发生错误时,错误将在此被捕获有两个个疑问:
CustomException
),仅仅是这样的需求的话,为什么不直接通过过滤器(HttpExceptionFilter
)捕获错误呢?因为拦截器抛出的异常(CustomException
)最终依然是交给过滤器(HttpExceptionFilter
)来处理,而过滤器的第一个参数exception
是有完整的错误信息的throwError(new CustomException({ message, error }, statusCode));
,这样的写法会导致在终端中打印出 抛出异常的无效堆栈信息,并没有记录实质的请求相关的内容
我在生产环境中并没有关闭
NestJS
的Logger
,所以我在HttpExceptionFilter
中多加了些打印日志The text was updated successfully, but these errors were encountered: