Reputation: 1660
I went though this presentation and added the necessary Ember.onerror(error);
to the application route's error action. However, when I attempt to log the error, I am getting what seems to be the route object (not sure what it is). Are there some additional steps I need to take? I'm using Ember CLI v.40 and Ember v1.6.1.
// routes/application.js
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
...
error: function(error) {
Ember.onerror(error);
return true;
}
}
});
// initializers/bugsnag.js
import Ember from 'ember';
export default {
name : 'bugsnag',
after : 'ajax-prefilter',
initialize: function(container) {
var appController, currentRoute;
try {
appController = container.lookup('controller:application');
currentRoute = appController.get('currentPath');
} catch(e) {}
var context = { currentRoute: currentRoute };
Ember.onerror = function(error) {
// do something with error
console.log(error.stack) // undefined on route error
};
}
};
I get the following in the console (produced by ember, not my code), which is the information I'm attempting to get in the initializer:
Error while processing route: calendar.create
Upvotes: 2
Views: 1236
Reputation: 711
I've been using console.trace() in my route error handling method.
Em.Logger.log(error.stack);
if(! Em.isNone(console)) {
console.trace();
}
This usually produces enough info to further debug the issue. Note that using Em.Logger instead of console.log it will handle the case where some browser don't have console defined.
Upvotes: 1