Created
June 19, 2017 09:35
-
-
Save lucasscariot/3e6c2f4172f0267ab317b2977c4a53d2 to your computer and use it in GitHub Desktop.
Bugsnag and emberjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
import Ember from 'ember'; | |
import config from '../config/environment'; | |
export default { | |
name: 'bugsnag', | |
initialize: function(appInstance) { | |
const appController = appInstance.lookup('controller:application'); | |
Bugsnag.apiKey = config.BUGSNAG.key; | |
Bugsnag.releaseStage = config.environment; | |
Bugsnag.notifyReleaseStages = ['staging', 'production']; | |
// Notify Routing Errors and edge cases | |
Ember.onerror = function(error) { | |
Bugsnag.context = appController.get('currentPath'); | |
Bugsnag.notifyException(error); | |
console.error(error.stack); | |
}; | |
// Notify Promises Errors | |
Ember.RSVP.on('error', function (error) { | |
Bugsnag.context = appController.get('currentPath'); | |
Bugsnag.notifyException(error); | |
}); | |
// Notify Ember Logger Errors | |
Ember.Logger.error = function (message, cause, stack) { | |
Bugsnag.context = appController.get('currentPath'); | |
Bugsnag.notifyException(new Error(message), null, { cause: cause, stack: stack }); | |
console.error(stack); | |
}; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment