-
Notifications
You must be signed in to change notification settings - Fork 110
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
Handle errors when serializing logged objects in console plugin #760
base: master
Are you sure you want to change the base?
Conversation
🤖 Pull request artifacts
|
I observe that typing After fixing in Chrome, after waiting for some time, the output is displayed correctly. |
That's what i thought... the code is missing a catch... will comment where... |
cache = null; | ||
return value; | ||
}); | ||
} finally { |
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.
There/here also needs to be a catch
, otherwise the error thrown will continue until browser handles it.
The catch should also return something for the output...
Maybe smth like
} catch (e) {
return "error rendering: " + String.valueOf(value);
}
... the idea is to output the message and string representation of that object which should output some nonsense like [[Object object]]
- which is still less confusing that either error or empty/undefined value
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.
indeed, but more likely v = "error rendering: " + String.valueOf(v);
just in case the dev used console.log(window, 42)
When serialization of a value for console output using
JSON.stringify()
fails for any reason, use itstoString()
implementation as a fallback instead of throwing.Closes #759