diff --git a/blueprints/ember-cli-bugsnag/files/app/initializers/bugsnag.js b/blueprints/ember-cli-bugsnag/files/app/initializers/bugsnag.js
index e88e98c..f9626ee 100644
--- a/blueprints/ember-cli-bugsnag/files/app/initializers/bugsnag.js
+++ b/blueprints/ember-cli-bugsnag/files/app/initializers/bugsnag.js
@@ -1,19 +1,27 @@
-import Ember from 'ember';
+import Ember from 'ember';
+import config from '../config/environment';
+
+var currentEnv = config.environment;
export default {
name: 'bugsnag-error-service',
initialize: function() {
- Ember.onerror = function (error) {
- Bugsnag.notifyException(error);
- };
+ if (Bugsnag.notifyReleaseStages.indexOf(currentEnv) !== -1) {
+ Ember.onerror = function (error) {
+ Bugsnag.context = container.lookup('router:main').get('location').getURL();
+ Bugsnag.notifyException(error);
+ };
- Ember.RSVP.on('error', function(error) {
- Bugsnag.notifyException(error);
- });
+ Ember.RSVP.on('error', function(error) {
+ Bugsnag.context = container.lookup('router:main').get('location').getURL();
+ Bugsnag.notifyException(error);
+ });
- Ember.Logger.error = function (message, cause, stack) {
- Bugsnag.notifyException(new Error(message), null, { cause: cause, stack: stack });
- };
+ Ember.Logger.error = function (message, cause, stack) {
+ Bugsnag.context = container.lookup('router:main').get('location').getURL();
+ Bugsnag.notifyException(new Error(message), null, { cause: cause, stack: stack });
+ };
+ }
}
};
diff --git a/blueprints/ember-cli-bugsnag/index.js b/blueprints/ember-cli-bugsnag/index.js
index b7b3b20..0a4ebe6 100644
--- a/blueprints/ember-cli-bugsnag/index.js
+++ b/blueprints/ember-cli-bugsnag/index.js
@@ -10,9 +10,6 @@ module.exports = {
},
afterInstall: function() {
-
- this.addBowerPackageToProject('bugsnag', '~2.4.7');
-
this.insertIntoFile('.jshintrc', ' "Bugsnag",', {
after: '"predef": [\n'
});
diff --git a/index.js b/index.js
index ef8901b..a13414e 100644
--- a/index.js
+++ b/index.js
@@ -10,15 +10,18 @@ module.exports = {
var content = '';
var bugsnagConfig;
- if (type === 'head' && config.environment !== 'test') {
+ if (type === 'head') {
bugsnagConfig = readConfig();
content = [
+ '',
''
];
}