Closed noahziheng closed 1 year ago
Patch coverage: 93.33
% and project coverage change: -0.07
:warning:
Comparison is base (
43649d0
) 91.71% compared to head (a7bfe23
) 91.65%.
:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
之前考虑通过 instanceof 匹配错误类的话,需要对 Filter 全量 Map 做遍历,有性能损耗,所以匹配时直接用了
Map().has(constructor)
的方案;但这种情况下,对于以下的继承场景将有遗漏,如下:
所以计划匹配阶段增加对异常实例原型链的循环,从子到父,直到 prototype 不为 class(根级),期间如有命中直接返回(相当于越精确的 Filter 优先级越高,如上例
@Catch(InputError)
>@Catch(BaseError)
);以此策略支持有继承场景的 ExceptionFilter,考虑到异常的继承嵌套不会很长(通常比 Filter 数量小且可控),性能损失相对有限。