-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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: use original Error object for uncaught errors when provided in browser #5080
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,8 +71,11 @@ process.listenerCount = function (name) { | |
|
||
process.on = function (e, fn) { | ||
if (e === 'uncaughtException') { | ||
global.onerror = function (err, url, line) { | ||
fn(new Error(err + ' (' + url + ':' + line + ')')); | ||
global.onerror = function (err, url, line, colno, error) { | ||
if (!error) { | ||
error = new Error(err + ' (' + url + ':' + line + ')'); | ||
} | ||
fn(error); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aha! I'd filed #5106 before seeing this PR. Great. I'll close that one since this once came first. [Feature] What do you think about including Request adding it in as a new nicety, unless you know of a reason not to. |
||
return !mocha.options.allowUncaught; | ||
}; | ||
uncaughtExceptionHandlers.push(fn); | ||
|
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.
[Testing] Could you add a unit test too, please?
#5107 has a reference if that's helpful.