New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ember-cli-uncharted-errors

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-cli-uncharted-errors

This library pulls together several different types of ember errors and reports them in a single event called `reportError`

  • 0.0.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

UnchartedCode Errors Build Status

This library pulls together several different types of ember errors and reports them in a single event called reportError. It's meant to be used to send these errors to external reporting services.

Installation

ember install:addon ember-cli-uncharted-errors

Usage

Once you install this within your project it will automatically pull errors out of Ember.onerror, Ember.RSVP.error, Ember.ActionHandler and error within the application route. Several events will be spun off depending on the status (if it's an HTTP error.)

Unauthorized

If the error received has an HTTP status of 401 it will trigger the event authorizationFailed. You can capture that in your route and handle appropriately. Here is an example from the UserLoginRoute.

  actions: {
    authorizationFailed: function(transition) {
      var controller = this.controllerFor('user.login');
      controller.set('error', true);
      controller.set('loading', false);
    }
  }

Unavailable

If the error received has an HTTP status of 503 it will trigger the event reportUnavailable. This will essentially mean the server is in maintenance. Handling of this will depend from app to app and this will give you a good spot to notify your users of the maintenance and (optionally) retry the transition.

  actions: {
    reportUnavailable: function(transition) {
      alert('Service is temporarily unavailble');
    }
  }

Error

The main event in this library is reportError. It's meant to either report the error to the user or to a third-party system. In this example we're reporting to Sentry.

  actions: {
    reportError: function(error, context, route, transition) {
      if (!window.Raven) {
        return;
      }

      var context;

      if (route) {
        context = Ember.$.extend(context, {
          server_revision: route.get('version.server_version'),
          browser_revision: route.get('version.client_version')
        });

        Raven.setUser({
          email: route.get('current_user.email')
          id: route.get('current_user.id')
        });
      }

      Raven.captureException(error, { extra: context });
    }
  }

Development

Installation

  • git clone this repository
  • npm install
  • bower install

Running

Running Tests

  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://www.ember-cli.com/.

Keywords

FAQs

Package last updated on 26 Mar 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc