-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix: Make sure that error is present before logging it in Vue #3183
Conversation
size-limit report
|
@@ -426,7 +426,7 @@ export class Vue implements Integration { | |||
|
|||
if (this._options.logErrors) { | |||
if (this._options.Vue.util) { | |||
this._options.Vue.util.warn(`Error in ${info}: "${error.toString()}"`, vm); | |||
this._options.Vue.util.warn(`Error in ${info}: "${error && error.toString()}"`, vm); |
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.
I don't know Vue, but will there ever be info
if there is no error
? What about vm
?
In any case, it might be nice to provide the user with the information that the error is null rather than just now showing anything. That way, they know it's not the reporting that's broken.
this._options.Vue.util.warn(`Error in ${info}: "${error && error.toString()}"`, vm); | |
this._options.Vue.util.warn(`Error in ${info}: "${error && error.toString() || 'null'}"`, vm); |
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.
Error in foo: null
Looks strange to me, why would there be a warning in the first place.
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.
Worse than Error in foo:
, though? The dangling colon feels wrong to me.
Maybe Error in foo: <null>
is better?
Since this was a bug, could we add a corresponding test case? Ok to do it in a follow up if you want to ship this timely. |
Will do that @rhcarvalho, just wanted to make sure it's unblocked for some people. |
Fixes #3178