使用 Raven.js有没有办法确定何时将错误成功记录到 Sentry 服务器

Using Raven.js is there a way to determine when an error is successfully logged to the Sentry server?

本文关键字:成功 错误 记录 服务器 Sentry 何时 js Raven 有没有 使用      更新时间:2023-09-26

我正在构建一个Ionic应用程序并使用Sentry进行日志记录。我正在呼叫Raven.captureMessage(),我需要知道错误何时成功记录,以便我可以将其从本地缓存中删除。

我将错误保存在本地缓存中,以便在出现连接问题时可以稍后重新发送它们。

Raven 中有一个未记录的"events"API.js其工作原理如下:

document.addEventListener('ravenSuccess', function (evt) {
  console.log(evt.data); // event data
});

我建议查看源代码以了解其工作原理:https://github.com/getsentry/raven-js/blob/master/src/raven.js#L1011

我们还在 GitHub 上开始了关于重做事件 API 的讨论——您的反馈将不胜感激:https://github.com/getsentry/raven-js/issues/524