【问题标题】:sentry captureException doesnt show the entire errorsentry captureException 不显示整个错误
【发布时间】:2022-10-18 17:25:37
【问题描述】:

我在我的 NextJS 应用程序中使用 captureException(error); 在 catch 块中捕获错误。

但是,在 Sentry 中,它并没有像我在开发人员控制台中看到的那样显示整个错误消息。例如它只说:AxiosError: Network Error(见下图)。

如何确保获得整个错误对象? 例如,在开发人员控制台中,我看到: Access to XMLHttpRequest at 'https://www.hello.com/' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.但这不是哨兵

【问题讨论】:

    标签: next.js sentry


    【解决方案1】:

    您在屏幕截图上看到的内容称为“面包屑”。在用户会话期间发生的事件。

    Access to XMLHttpRequest... 是浏览器网络错误,它没有暴露给 JS API,因此您将无法捕获它。

    如果你想调查你的网络错误有什么可用的,你可以使用beforeBreadcrumb回调,详见https://docs.sentry.io/platforms/javascript/enriching-events/breadcrumbs/#customize-breadcrumbs

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-06-19
      • 2021-10-30
      • 1970-01-01
      • 2014-10-12
      • 2016-05-08
      • 2012-08-12
      • 2014-03-25
      • 2013-02-10
      相关资源
      最近更新 更多