egg中进行异常捕获时,能否指定某些错误不被写入日志 #5310
Unanswered
wangyige0701
asked this question in
Q&A
Replies: 1 comment 1 reply
-
不抛出错误,写个中间件拦截异常。 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
我在写接口时因为经常复用逻辑,所以处理异常请求时选择直接在代码里抛出一个错误,然后在最外层的配置里添加config.onerror进行统一捕获并返回错误响应。
但是这样就造成每次抛出异常,相关的错误堆栈信息都会被记录到日志里,但是这些信息并不需要被记录,不知道egg里的错误捕获能不能支持在写入日志前进行一次判断。
Beta Was this translation helpful? Give feedback.
All reactions