0

我在代码中大量使用 npm 模块“不变”来进行运行时检查并抛出错误。问题在于 Stackdriver 错误报告似乎将所有这些错误归为一类,因为它们源自同一个函数和/或以短语“不变违规...”开头。

有没有一种方法可以在不重构所有代码的情况下防止这种分组发生?

这对我来说是一个大问题,因为一些严重错误没有出现并且没有被报告为新错误,所以它在很大程度上挫败了我首先报告错误的原因。

----- 一些样品----

{ Invariant Violation: You are not allowed to report the same data as the previous report
    at invariant (/srv/node_modules/invariant/invariant.js:40:15)
    at Object.<anonymous> (/srv/src/modules/loads/respond.ts:123:5)
    at Generator.next (<anonymous>)
    at fulfilled (/srv/build/modules/loads/respond.js:4:58)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:229:7) name: 'Invariant Violation', framesToPop: 1 }

{ Invariant Violation: User uoipWa1yARgdudN4mFmtYrYoOID3 is not subscribed to flight 2f0291571b06322e2737b627fdca2ff0
    at invariant (/srv/node_modules/invariant/invariant.js:40:15)
    at Object.<anonymous> (/srv/src/modules/loads/request.ts:373:3)
    at Generator.next (<anonymous>)
    at fulfilled (/srv/build/modules/loads/request.js:4:58)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:229:7) name: 'Invariant Violation', framesToPop: 1 }
4

1 回答 1

0

我最好的建议是修复不变的违规,然后将错误组标记为“已解决”。任何额外的不变错误都将被视为存在新错误。

于 2019-06-06T14:18:58.547 回答