0


我将 raven 与我的 django Web 应用程序一起使用,我想防止异常过度分组,如此处文档中所述,同时保留其他异常的默认行为。
更具体地说,我的应用程序中有这样的代码片段:

raise Exception('Nothing done for catalog #' + str(catalog_id))

在哨兵中,我看到不同目录的异常分组在一起,因为它根据堆栈跟踪将它们汇总起来。正如我从文档中了解到的那样,我应该使用类似的东西:

client.captureException(fingerprint=['{{ default }}', str(catalog_id)])

但我不知道应该在我的代码中的哪个位置使用它。

4

1 回答 1

2

client.captureException(fingerprint=['{{ default }}', str(catalog_id)])except在子句内使用。

try:
    raise Exception('Nothing done for catalog #' + str(catalog_id))
except Exception:
    client.captureException(fingerprint=['{{ default }}', str(catalog_id)])

参考:

于 2017-09-04T15:29:14.977 回答