Skip to content

Commit b51bc89

Browse files
committed
Merge pull request #330 from joeyespo/improve-rsvp-onerror
Improve the capture of unhandled errors from promises
2 parents a1c0afc + 516047e commit b51bc89

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

plugins/ember.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ Ember.onerror = function EmberOnError(error) {
1818
_oldOnError.call(this, error);
1919
}
2020
};
21-
Ember.RSVP.on('error', function (err) {
22-
Raven.captureException(err);
21+
Ember.RSVP.on('error', function (reason) {
22+
if (reason instanceof Error) {
23+
Raven.captureException(reason, {extra: {context: 'Unhandled Promise error detected'}});
24+
} else {
25+
Raven.captureMessage('Unhandled Promise error detected', {extra: {reason: reason}});
26+
}
2327
});
2428

2529
}(window, window.Raven, window.Ember));

0 commit comments

Comments
 (0)