-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
Exceptions thrown in errorHandler halt app #6714
Comments
Why don't you console.error the error instead of throwing it inside of the errorHandler? |
That is the patch I submitted to Raven, they were doing a lot of logic in their errorHandler (to increase the value of the reported error - good stuff, actually!) without careful try/catches, not to mention some things that made me suspect they hadn't run their Vue plugin in production much. That being said, the failure mode was so silent, catastrophic, (and hard to debug!) that I figured a quick try/catch around the errorHandler might save some people in the future some headache. |
But I think you shouldn't throw errors in the errorHandler, you should treat all of them but not generate new one or ignore them (throwing them) |
I agree with you. However, if you don't do what you should, I think the app shouldn't crash, especially since it's so easy to prevent that error from becoming catastrophic. |
But that's because throwing errors in js make apps crash... |
Almost anywhere in a Vue app, throwing an error does not. |
@dts How do I actually throw an error in your vue app then? after the commit 2b5c83a, there's no way of doing that anymore. Why would I need this? Because I'm testing my vue.js app in a google chrome using cypress and I want to let a test fail when there's an error. But with the change, this is not possible anymore. So how would I actually raise an error which happens inside a vue component? |
@siegy22 - Some more context would be helpful. My guess is that you may be able to set your own error handler, and hook that up to cypress. Letting exceptions "escape" is usually not ideal - they should be caught and reported somewhere, and that's what the error handler is for. |
Version
2.4.4
Reproduction link
https://jsfiddle.net/qok5vcnf/1/
Steps to reproduce
Add an errorHandler that throws an exception, and notice that the app halts badly.
What is expected?
Exceptions thrown from errorHandlers should use the console to print something, or fail silently.
What is actually happening?
The whole app rendering halts.
Was using the raven-js plugin for Vue, which triggers this behavior. I have filed an issue over there with my feedback (getsentry/sentry-javascript#1061), but I thought it might save some future developers time to not fail quite so catastrophically in this case.
The text was updated successfully, but these errors were encountered: