[英]Sentry.captureMessage() fails if location changes
If browser location changes (eg, window.location.replace()), Sentry fails with如果浏览器位置发生变化(例如,window.location.replace()),Sentry 将失败并显示
Sentry Logger [error]: Failed while sending event: TypeError: NetworkError when attempting to fetch resource
Is there no way to await the POST to the ingest?没有办法等待 POST 来摄取吗?
The docs are lacking but Sentry.flush() does give us a promise that can be awaited.缺少文档,但 Sentry.flush() 确实给了我们一个可以等待的承诺。 So it might look like
所以它可能看起来像
Sentry.captureMessage()
await Sentry.flush()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.