@jasonaughton wrote:
I have an error handling function set up in an initalizer, thus:
export function initialize() { function report_error(error) { var data = { name: error.name, message: error.message, stack: error.stack, url: document.location.href }; Ember.$.ajax(ENV.apiHost + '/api/errors', { type: 'POST', data: data }); } Ember.onerror = report_error; Ember.RSVP.configure('onerror', report_error); } export default { name: 'error', initialize };
The error is being thrown in a route like this:
model(params) { let dts_reference = params.dts_reference; this.get('service').completePurchase(dts_reference).then(result => { if (result) { this.transitionTo('confirmation'); } else { this.transitionTo('payment-error'); } }).catch((error) => { throw new Error(error); }); }
When the error is thrown, the error handing function runs but the error route does not load. This only happens when I throw the Error from this route, when thrown in the same way from my controllers the error route loads as expected.
Any suggestions?
Posts: 1
Participants: 1