Skip to content

Fatsoma/ember-cli-honeybadger-io

Repository files navigation

ember-cli-honeybadger-io CircleCI

Javascript error tracking with https://www.honeybadger.io

honeybadger.js docs https://github.com/honeybadger-io/honeybadger-js

Install the addon:

ember install ember-cli-honeybadger-io

Configuration

For more options see honeybadger.js docs.

config/environment.js

ENV.honeybadger = {
  apiKey: 'project api key'
}
ember g instance-initializer honeybadger

instance-initializers/honeybadger.js

import Ember from 'ember';

const { RSVP, set } = Ember;

export function initialize(appInstance) {
  let service = appInstance.lookup('service:honeybadger');

  Ember.onerror = function(error) {
    service.notify(error);
  };

  RSVP.on('error', function(error) {
    service.notify(error);
  });

  // optional extras/ideas
  /* let session = appInstance.lookup('service:session');

  set(service, 'beforeNotify', (notice) => {
    notice.context = {
      userId: session.userId
    };

    notice.cookies = document.cookies
  }); */
}

export default {
  name: 'honeybadger',
  initialize
};

Notes

honeybadger.js is lazy loaded via service.notify.

Addon by Fatsoma