Skip to content
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 Meteor 7679 #258

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions lib/hijack/wrap_session.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,35 @@ function wrapMethodHanderForErrors(name, originalHandler, methodMap) {
try{
return originalHandler.apply(this, arguments);
} catch(ex) {
// create a kadira exception
// don't change the original exception so that
// Meteor output of the exception is not impacted
// Meteor #7679
var kex;
if(ex && Kadira._getInfo()) {
// sometimes error may be just an string or a primitive
// in that case, we need to make it a psuedo error
if(typeof ex !== 'object') {
ex = {message: ex, stack: ex};
kex = {message: ex, stack: ex};
} else {
// create a new error via constructor
// set stack properly
if(ex.constructor) {
kex = new ex.constructor();
kex.message = ex.message;
} else {
kex = {message: ex.message};
}
}
if(ex.stack) kex.stack = ex.stack;
// Now we are marking this error to get tracked via methods
// But, this also triggers a Meteor.debug call and
// it only gets the stack
// We also track Meteor.debug errors and want to stop
// tracking this error. That's why we do this
// See Meteor.debug error tracking code for more
ex.stack = {stack: ex.stack, source: 'method'};
Kadira._getInfo().currentError = ex;
kex.stack = {stack: kex.stack, source: 'method'};
Kadira._getInfo().currentError = kex;
}
throw ex;
}
Expand Down