-
Notifications
You must be signed in to change notification settings - Fork 424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Do not) suppress errors by default #236
Comments
Thanks for opening the issue! Stimulus calls your application’s code in a few different places:
In each case, these calls happen inside a Inside the So this may be a case of each of us having a different idea of what it means for a framework to be “developer friendly.” My opinion is that it is more friendly for the framework not to break when application code raises an exception. I also think our error logging is better, and that it’s a mischaracterization to say errors are “suppressed” when they appear by default in the browser’s console. I admit that documentation around the It’s also quite possible there’s a solution I haven’t considered that would let us have the best of both worlds: framework resilience against application errors and automatic compatibility with tools like Sentry. Again, I’d love to discuss this, if you have any ideas. Until then, closing this issue since things are working as designed. |
@sstephenson I just stumbled across this after being stung by something similar in production. In terms of docs, I have two ideas on how to make this more visible.
I tend to think option 1 is worth doing; option 2 feels a bit much.
Most tools I've seen set handleError(error: Error, message: string, detail: object) {
this.logger.error(`%s\n\n%o\n\n%o`, message, error, detail)
window.onerror && window.onerror(message, null, null, null, error)
} Happy to put together PRs for either/both of these changes, if you'd be open to them? |
Proposing some changes that I mentioned [here](hotwired#236 (comment)). To recap, I think the error logging in Stimulus is great, but several people (me included) have been caught by the fact that errors aren't reported elsewhere out of the box. The aim of this PR is to automatically integrate with third party error tracking services where possible, and to improve the documentation where not. Specific changes: - If `window.onerror` is defined, Stimulus will now call it after logging an error. Many error tracking tools define this method, eg. [Sentry](https://github.com/getsentry/sentry-javascript/blob/0ee07995d415d3870608c477cbdcf8445a51e1bb/packages/browser/src/loader.js#L192), [Airbrake](https://github.com/airbrake/airbrake-js/blob/9d4787b1c559aa39107d7288f46c4108c9a9d954/packages/browser/src/notifier.ts#L70) - Added documentation on how error handling works, including what happens out of the box and how to override it (with code sample from hotwired#53) - Added tests for the error handler.
Proposing some changes that I mentioned [here](hotwired#236 (comment)). To recap, I think the error logging in Stimulus is great, but several people (me included) have been caught by the fact that errors aren't reported elsewhere out of the box. The aim of this PR is to automatically integrate with third party error tracking services where possible, and to improve the documentation where not. Specific changes: - If `window.onerror` is defined, Stimulus will now call it after logging an error. Many error tracking tools define this method, eg. [Sentry](https://github.com/getsentry/sentry-javascript/blob/0ee07995d415d3870608c477cbdcf8445a51e1bb/packages/browser/src/loader.js#L192), [Airbrake](https://github.com/airbrake/airbrake-js/blob/9d4787b1c559aa39107d7288f46c4108c9a9d954/packages/browser/src/notifier.ts#L70) - Added documentation on how error handling works, including what happens out of the box and how to override it (with code sample from hotwired#53) - Added tests for the error handler.
Proposing some changes that I mentioned [here](hotwired#236 (comment)). To recap, I think the error logging in Stimulus is great, but several people (me included) have been caught by the fact that errors aren't reported elsewhere out of the box. The aim of this PR is to automatically integrate with third party error tracking services where possible, and to improve the documentation where not. Specific changes: - If `window.onerror` is defined, Stimulus will now call it after logging an error. Many error tracking tools define this method, eg. [Sentry](https://github.com/getsentry/sentry-javascript/blob/0ee07995d415d3870608c477cbdcf8445a51e1bb/packages/browser/src/loader.js#L192), [Airbrake](https://github.com/airbrake/airbrake-js/blob/9d4787b1c559aa39107d7288f46c4108c9a9d954/packages/browser/src/notifier.ts#L70) - Added documentation on how error handling works, including what happens out of the box and how to override it (with code sample from hotwired#53) - Added tests for the error handler.
Proposing some changes that I mentioned [here](hotwired#236 (comment)). To recap, I think the error logging in Stimulus is great, but several people (me included) have been caught by the fact that errors aren't reported elsewhere out of the box. The aim of this PR is to automatically integrate with third party error tracking services where possible, and to improve the documentation where not. Specific changes: - If `window.onerror` is defined, Stimulus will now call it after logging an error. Many error tracking tools define this method, eg. [Sentry](https://github.com/getsentry/sentry-javascript/blob/0ee07995d415d3870608c477cbdcf8445a51e1bb/packages/browser/src/loader.js#L192), [Airbrake](https://github.com/airbrake/airbrake-js/blob/9d4787b1c559aa39107d7288f46c4108c9a9d954/packages/browser/src/notifier.ts#L70) - Added documentation on how error handling works, including what happens out of the box and how to override it (with code sample from hotwired#53) - Added tests for the error handler.
Proposing some changes that I mentioned [here](hotwired#236 (comment)). To recap, I think the error logging in Stimulus is great, but several people (me included) have been caught by the fact that errors aren't reported elsewhere out of the box. The aim of this PR is to automatically integrate with third party error tracking services where possible, and to improve the documentation where not. Specific changes: - If `window.onerror` is defined, Stimulus will now call it after logging an error. Many error tracking tools define this method, eg. [Sentry](https://github.com/getsentry/sentry-javascript/blob/0ee07995d415d3870608c477cbdcf8445a51e1bb/packages/browser/src/loader.js#L192), [Airbrake](https://github.com/airbrake/airbrake-js/blob/9d4787b1c559aa39107d7288f46c4108c9a9d954/packages/browser/src/notifier.ts#L70) - Added documentation on how error handling works, including what happens out of the box and how to override it (with code sample from hotwired#53) - Added tests for the error handler.
Proposing some changes that I mentioned [here](hotwired#236 (comment)). To recap, I think the error logging in Stimulus is great, but several people (me included) have been caught by the fact that errors aren't reported elsewhere out of the box. The aim of this PR is to automatically integrate with third party error tracking services where possible, and to improve the documentation where not. Specific changes: - If `window.onerror` is defined, Stimulus will now call it after logging an error. Many error tracking tools define this method, eg. [Sentry](https://github.com/getsentry/sentry-javascript/blob/0ee07995d415d3870608c477cbdcf8445a51e1bb/packages/browser/src/loader.js#L192), [Airbrake](https://github.com/airbrake/airbrake-js/blob/9d4787b1c559aa39107d7288f46c4108c9a9d954/packages/browser/src/notifier.ts#L70) - Added documentation on how error handling works, including what happens out of the box and how to override it (with code sample from hotwired#53) - Added tests for the error handler.
Proposing some changes that I mentioned [here](hotwired#236 (comment)). To recap, I think the error logging in Stimulus is great, but several people (me included) have been caught by the fact that errors aren't reported elsewhere out of the box. The aim of this PR is to automatically integrate with third party error tracking services where possible, and to improve the documentation where not. Specific changes: - If `window.onerror` is defined, Stimulus will now call it after logging an error. Many error tracking tools define this method, eg. [Sentry](https://github.com/getsentry/sentry-javascript/blob/0ee07995d415d3870608c477cbdcf8445a51e1bb/packages/browser/src/loader.js#L192), [Airbrake](https://github.com/airbrake/airbrake-js/blob/9d4787b1c559aa39107d7288f46c4108c9a9d954/packages/browser/src/notifier.ts#L70) - Added documentation on how error handling works, including what happens out of the box and how to override it (with code sample from hotwired#53) - Added tests for the error handler.
Proposing some changes that I mentioned [here](hotwired#236 (comment)). To recap, I think the error logging in Stimulus is great, but several people (me included) have been caught by the fact that errors aren't reported elsewhere out of the box. The aim of this PR is to automatically integrate with third party error tracking services where possible, and to improve the documentation where not. Specific changes: - If `window.onerror` is defined, Stimulus will now call it after logging an error. Many error tracking tools define this method, eg. [Sentry](https://github.com/getsentry/sentry-javascript/blob/0ee07995d415d3870608c477cbdcf8445a51e1bb/packages/browser/src/loader.js#L192), [Airbrake](https://github.com/airbrake/airbrake-js/blob/9d4787b1c559aa39107d7288f46c4108c9a9d954/packages/browser/src/notifier.ts#L70) - Added documentation on how error handling works, including what happens out of the box and how to override it (with code sample from hotwired#53) - Added tests for the error handler.
Re-issued by @sstephenson's request. Related comment in #53
Summary:
Currently javascript errors are not being propagated by default. Custom error handler console-warns about errors - it breaks default behavior of popular error catcher services like sentry that are relying on
window.onerror
function.I don't think such behavior is developer friendly and expected for outside (Basecamp) developers - may I ask what was the reasoning behind it? 🤔
The text was updated successfully, but these errors were encountered: