sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

No console errors shown if unhandled error occured

Open maxaon opened this issue 6 years ago • 2 comments

Package + Version

  • [x] @sentry/browser
  • [ ] @sentry/node
  • [ ] raven-js
  • [ ] raven-node (raven for node)
  • [ ] other:

Version:

@sentry/browser 5.9.0 and later

Description

All unhandled errors are logged to sentry but not shown in console. Because of this issue it's impossible to now where error occurs when console is opened Example code:

<script
  src="https://browser.sentry-cdn.com/5.9.1/bundle.min.js"
  integrity="sha384-/x1aHz0nKRd6zVUazsV6CbQvjJvr6zQL2CHbQZf3yoLkezyEtZUpqUNnOLW9Nt3v"
  crossorigin="anonymous"
></script>
<script>
  Sentry.init({
    dsn: "https://[email protected]/1208645"
  });
  setTimeout(() => {
    throw new Error("Demo error");
  }, 10);
</script>

Expected result: Error is shown in console and reported to sentry. Actual result: Error not shown in console and reported to sentry.

This issue was introduced when returning true from onerror handler. This was changed in this commit: https://github.com/getsentry/sentry-javascript/commit/d716bd96952cdd7a86662246b8b0f80761fe1275

Demo page: https://jsbin.com/rumugequke

maxaon avatar Dec 04 '19 17:12 maxaon

@maxaon I used your demo page and it works just fine ¯_(ツ)_/¯

image

kamilogorek avatar Dec 06 '19 11:12 kamilogorek

It's only working because of jsbin handler. Ignore me. Fix is coming.

Duplicate of https://github.com/getsentry/sentry-javascript/issues/1600

kamilogorek avatar Dec 06 '19 14:12 kamilogorek