Setting up Airbrake on an Ember application

airbrake, ember.js, javascript

Solution

Assuming you've included Airbrake-js you can hook on Ember's `onerror` handler and push errors.

Ember.onerror = function(err) { // any ember error
    Airbrake.push(err);
    //any other error handling
};
Ember.RSVP.configure('onerror',function(err){ // any promise error
    Airbrake.push(err);
    console.error(e.message);
    console.error(e.stack);
    //any other generic promise error handling
};
window.onerror = function(err){ // window general errors.
    Airbrake.push(err);
    //generic error handling that might not be Airbrake related.
};

You can see more options of different parameters of the data sent in the airbrake-js GitHub repository docs.

Problem

How do you set up Airbrake such that it gets context information from unhandled Javascript errors that occur in an Ember application?

Original source