Title: Why can't I catch an error directly after install() ? · Issue #418 · getsentry/sentry-javascript · GitHub
Open Graph Title: Why can't I catch an error directly after install() ? · Issue #418 · getsentry/sentry-javascript
X Title: Why can't I catch an error directly after install() ? · Issue #418 · getsentry/sentry-javascript
Description: Hi, Given the following code: window.onerror = err => console.error('Error caught:', err); foo The error will be caught with these messages in my console: Error caught: Script error Uncaught ReferenceError: foo is not defined However, gi...
Open Graph Description: Hi, Given the following code: window.onerror = err => console.error('Error caught:', err); foo The error will be caught with these messages in my console: Error caught: Script error Uncaught Refere...
X Description: Hi, Given the following code: window.onerror = err => console.error('Error caught:', err); foo The error will be caught with these messages in my console: Error caught: Script error Unca...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/418
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Why can't I catch an error directly after install() ?","articleBody":"Hi,\n\nGiven the following code:\n\n```\nwindow.onerror = err => console.error('Error caught:', err);\nfoo\n```\n\nThe error will be caught with these messages in my console:\n\n```\nError caught: Script error\nUncaught ReferenceError: foo is not defined\n```\n\nHowever, given this:\n\n```\nvar Raven = require('raven-js');\nRaven.config('https://MY_SENTRY_DSN@app.getsentry.com/31423').install();\nfoo\n```\n\nThe error won't be noticed at all by `Raven`:\n\n```\nUncaught ReferenceError: foo is not defined\n```\n\nI can confirm that `.install()` sets the `window.onerror` handler by looking at it before and after `.install()` is run.\n\nRunning: `Raven.captureException(new Error('This is an error!'));` after `.install()` does, however, log;\n\n```\nRaven about to send:\n> Object { ........\n```\n\nSo it seems able to capture through `captureException`, but not through `window.onerror`, am I missing something here? (Using Chrome & Webpack with babel)\n\nI get that `ReferenceError` is often something you might not wanna look at, but it's explicitly included [in the docs](https://docs.getsentry.com/hosted/clients/javascript/config/) So I'm a bit confused if Raven always ignores those errors.\n\nThank you!\n","author":{"url":"https://github.com/prewk","@type":"Person","name":"prewk"},"datePublished":"2015-11-10T14:32:40Z","url":"https://github.com/getsentry/sentry-javascript/issues/418"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:448cd1f6-c29e-5f5a-0fb5-650c60237e4f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E29E:C5218:3A8AEF:500188:6B04BD8A |
| html-safe-nonce | 91cb79178d7f237351fb0bcc13bf23ce0fc033770db4c642b400bcb4069fa4fe |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMjlFOkM1MjE4OjNBOEFFRjo1MDAxODg6NkIwNEJEOEEiLCJ2aXNpdG9yX2lkIjoiMTg1MDM5MTk3MDEzMzA5Nzg2NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7a8766bd689d44fc50f4dca00d720a1a1a68316ba7008d0b0c3e01dfd5cfbccc |
| hovercard-subject-tag | issue:116118163 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/418/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3423a5532464da27f0d7b3d12bfec52f65067463c6396ba9233e7e6ad4c01c7e/getsentry/sentry-javascript/issues/418 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3423a5532464da27f0d7b3d12bfec52f65067463c6396ba9233e7e6ad4c01c7e/getsentry/sentry-javascript/issues/418 |
| og:image:alt | Hi, Given the following code: window.onerror = err => console.error('Error caught:', err); foo The error will be caught with these messages in my console: Error caught: Script error Uncaught Refere... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | prewk |
| hostname | github.com |
| expected-hostname | github.com |
| None | 85dd75377eb77313206b8fc108bcee6a3a029286d94bf32bf9b4426e4d92e0c4 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 0d64fa748a2bab9a5b587a967ac4da1cfa8da6dd |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width