如果框架中存在 IExceptionLogger
接口(interface),为什么总是存在异常日志记录( IExceptionFilter
)概念?
最佳答案
如今,Web API中没有简便的方法可以在全局范围内记录或处理错误。某些未处理的异常可以通过异常过滤器进行处理,但是在很多情况下,异常过滤器无法处理。例如:
Exceptions thrown from controller constructors
Exceptions thrown from message handlers
Exceptions thrown during routing
Exceptions thrown during response content serialization
更多here