Capturing and reporting errors in production

I have recently set up an errbit ( install that works great for server-side errors but the client-side errors aren’t very useful because they only return the error text with no context, for example:

Uncaught Error: Something you did caused a view to re-render after it rendered but before it was inserted into the DOM.

With this there’s no way to tell where in the app it occurred or what might have caused the error.

How are people capturing and reporting client-side errors in their production apps? Is there a better way of capturing Ember errors along with their stack trace?




Ember.onerror = function(error) {
    Ember.$.ajax('/report-error', 'POST', {
        stack: error.stack,
        otherInformation: 'whatever app state you want to provide'

Or use services like Errorception, ExceptionHub, Debuggify, Airbrake…

EDIT: also

Hope this helps? Did not test it for myself…

1 Like

Yes, Ember.onerror is what you want, but be aware that there are some open issues that will prevent certain exceptions from being reported there. See

To trap wider range of potential errors, I do the following (report_error is my function that takes an Exception and deals with logging and reporting it):

 // Trap exceptions from within Ember run loop
 Ember.onerror = report_error;

 // Trap unhandled RSVP promise failures
 Ember.RSVP.configure('onerror', report_error);

 // Trap unhandled failures during routing
 App.ApplicationRoute = Ember.Route.extend({
      actions: { error: report_error }

// Safety net to report any untrapped exceptions on browsers
// that respect window.onerror.  Currently, failures from within 
// Backburner callbacks will end up here. This is inferior to the 
// other handlers because the stack trace is missing by the 
// time the exception gets here.
window.onerror = report_error;

Thanks for the help guys. I have ended up switching to BugSense for JS errors as they seemed to have the best support for custom error notification.

I’ll post an update here once I’ve determined how successful the switch was.

I spoke too soon, still struggling to get any meaningful info from BugSense.

I think I’ll resort to building my own rails endpoint and submitting errors to that manually.

This is my first, quick pass at custom error reporting. It uses Airbrake and is formatted for display in Errbit (using the Airbrake interface you might be able to get better formatting using different options).

Note: Don’t use this in production as-is, it has a number of bugs and possibly some unwanted behaviour. If anyone builds a better solution, please share!


function report_error(error) {
  var extra_info = {};

  try {
    if (App.Auth.get('signedIn')) {
      user = App.Auth.get('user');
      extra_info['user_id'] = user.get('id');
      extra_info['user_username'] = user.get('username');
      extra_info['user_email'] = user.get('email');
  } catch(err) { }

  Ember.$.ajax('/errors', { type:'POST', data: {
    message: error.message,
    stack: error.stack,
    url: document.location.href,
    extra_info: extra_info

if (RAILS_ENV != 'development') {
  // Trap exceptions from within Ember run loop
  Ember.onerror = report_error;

  // Trap unhandled RSVP promise failures
  Ember.RSVP.configure('onerror', report_error);


def create
  extra_info = params[:extra_info]

  user = {}
  user['id'] = extra_info.delete('user_id')
  user['username'] = extra_info.delete('user_username')
  user['email'] = extra_info.delete('user_email')

    error_class: params[:name],
    error_message: params[:message],
    url: params[:url],
    environment_name: Rails.env,
    user: user,
    backtrace: [],
    component: params[:stack].lines[1],
    cgi_data: { stack: params[:stack] }

  render nothing: true, status: 200

Sentry is also great: It’s open source, so you can host it yourself too.

Sentry is working much better, thank you!

I set up my own instance on Heroku using One thing not mentioned is that you need to set the ALLOWED_HOSTS config in the file to avoid 500 errors.

Hello @lookingsideways! I’m a front-end engineer in BugSense and I maintain the javascript plugin. As we’re currently doing a major refactor of our plugin and we loved to get your feedback on how was your experience using our plugin.

Please ping me at dimitris[ at ]

Ember.RSVP.configure(‘onerror’, fn) is changed to Ember.RSVP.on(‘error’, fn)

ember-cli-sentry and ember-cli-deploy-sentry seem to be the best addons for handling error reporting. Sentry really is pretty amazing. Lots of useful integrations too. Check the pull requests and issues, currently the addon doesn’t put in the applicationRoute actions: { error: handler, so you’ll definitely want make sure you add this to you applicationRoute’s error action:

    error(error) {
      // Trap unhandled failures during routing:
      // Should maybe be handled by the sentry addon, but is not as of now: