Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Bugsnag Initializer for EmberJS
{
"predef": {
...
"Bugsnag": true,
...
},
...
}
{
...
"dependencies": {
...
"bugsnag": "~2.4.7"
}
}
...
var app = new EmberApp({
...
sourcemaps: {
"enabled": true,
"extensions": ["js"]
}
});
app.import('bower_components/bugsnag/src/bugsnag.js');
...
import Ember from 'ember';
import config from '../config/environment';
export default {
name: 'bugsnag',
after: 'authentication',
initialize: function(container) {
var appController = container.lookup('controller:application');
Bugsnag.apiKey = config.APP.BUGSNAG.API_KEY;
Bugsnag.releaseStage = config.environment;
Bugsnag.notifyReleaseStages = ["staging", "production"];
// Routing errors and edge cases
Ember.onerror = function(error) {
Bugsnag.context = appController.get('currentPath');
Bugsnag.notifyException(error);
console.error(error.stack);
};
// Errors that occur in Promises
Ember.RSVP.on('error', function (error) {
Bugsnag.context = appController.get('currentPath');
Bugsnag.notifyException(error);
});
// 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);
};
}
};
@binhums

This comment has been minimized.

Show comment Hide comment
@binhums

binhums Feb 24, 2015

Thank you! 👍

binhums commented Feb 24, 2015

Thank you! 👍

@patrickberkeley

This comment has been minimized.

Show comment Hide comment
@patrickberkeley

patrickberkeley May 11, 2017

@ToddSmithSalter thanks for this gist.

One question for you on:

  sourcemaps: {
    "enabled": true,
    "extensions": ["js"]
  }

This allows the public to have access to your unminified source, which could be a security/privacy concern (I know you can pretty print minified source, but sourcemaps make it too easy to knock off an entire application).

Do you have a method for uploading sourcemaps to bugsnag directly for an ember app?

@ToddSmithSalter thanks for this gist.

One question for you on:

  sourcemaps: {
    "enabled": true,
    "extensions": ["js"]
  }

This allows the public to have access to your unminified source, which could be a security/privacy concern (I know you can pretty print minified source, but sourcemaps make it too easy to knock off an entire application).

Do you have a method for uploading sourcemaps to bugsnag directly for an ember app?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment