-
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
Error handling improvements #365
Error handling improvements #365
Conversation
@@ -1,7 +1,7 @@ | |||
import { ControllerTestCase } from "../cases/controller_test_case" | |||
import { ClassController } from "../controllers/class_controller" | |||
|
|||
export default class ValueTests extends ControllerTestCase(ClassController) { | |||
export default class ClassTests extends ControllerTestCase(ClassController) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change isn't related to this PR, it just fixes an incorrect class name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Fixed in main by caecf0f
e37a2be
to
96256e4
Compare
Any chance that this is going to be merged in? I just went down a 4 hour rabbit hole trying to figure out why Sentry wasn't getting called unless I explicitly called it. Now that I see this PR, I see what's happening, but man was it a long road to find this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a much more friendly default 👍
@@ -1,7 +1,7 @@ | |||
import { ControllerTestCase } from "../cases/controller_test_case" | |||
import { ClassController } from "../controllers/class_controller" | |||
|
|||
export default class ValueTests extends ControllerTestCase(ClassController) { | |||
export default class ClassTests extends ControllerTestCase(ClassController) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Fixed in main by caecf0f
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.
96256e4
to
0dcdfc4
Compare
Thanks @sstephenson, made those fixes. |
Fantastic! |
Proposing some changes that I mentioned here. 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:
window.onerror
is defined, Stimulus will now call it after logging an error. Many error tracking tools define this method, eg. Sentry, Airbrake.