Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't seem to work with Ember 1.13.x #13

Closed
constantm opened this issue Jan 5, 2016 · 8 comments
Closed

Doesn't seem to work with Ember 1.13.x #13

constantm opened this issue Jan 5, 2016 · 8 comments

Comments

@constantm
Copy link

I'm using this addon with Errbit and had to add rack-cors to get it working (it looks like it uses an old version of the Airbrake API? Version 0.3 instead of 0.5). Anyway, from there I can push errors using Airbrake.push('error'). No browser or Ember errors get pushed though. Raising an error using throw 'test' doesn't get pushed. Neither do Ember errors. The following being an example:

model: function() {
    return this.get('sessionUser.objectnothere').then(user => user.get('company'));
  },

which raises:

Error while processing route: ats.opportunities.show.all.index Cannot read property 'then' of undefined TypeError: Cannot read property 'then' of undefined
    at model...

This surely has to work with Ember 0.13.x. Am I doing something wrong?

@bantic
Copy link
Member

bantic commented Jan 6, 2016

@constantm I've rewritten this to use the latest airbrake api and be a little smarter overall about how it works.
Can you try version 0.1.0? Probably easiest to remove the existing ember-cli-airbrake entry from your package.json and do: ember install ember-cli-airbrake@0.1.0. Your existing configuration should work with 0.1.0, but please check out the updated README if necessary.

@constantm
Copy link
Author

Awesome thanks, will give it a go! :)

@constantm
Copy link
Author

Right, I've had a look and it seems that I can inject the Airbrake service, and then manually send error notifications. However, it still doesn't catch window or Ember exceptions.

@bantic
Copy link
Member

bantic commented Jan 11, 2016

@constantm Can you let me know more about your setup? I misread this title before — are you actually using ember pre 1.0? Or Ember 1.13.x?

In Ember 1.13, it appears that errors in transitions do not get to the Ember onerror handler. They do in Ember 2.1. I think what you are going to want to do is add an error action in your application route that can use the airbrake service to explicitly send errors.

Here is an example app, btw, if you'd like to see what I was testing it with. Adding errors to the model hook of the application route do not get seen by ember-cli-airbrake with ember 1.13, but they do with ember 2.1.

@constantm constantm changed the title Doesn't seem to work with Ember 0.13.x Doesn't seem to work with Ember 1.13.x Jan 12, 2016
@constantm
Copy link
Author

@bantic Sorry about the title - meant 1.13.x :)

Thanks, I'll add in an action as suggested. I should probably update Ember sooner rather than later.

@bantic
Copy link
Member

bantic commented Jan 12, 2016

@constantm No worries, thanks for opening the issue. I'll add another one to document that the error action should be used in ember 1.13.x. (A doc PR would also be welcome). thanks!

@constantm
Copy link
Author

Wanted to add some docs for this and went over it again. It seems that it now actually does work with Ember 1.13.x? What's more, when an error occurs it doesn't actually bubble to the application route and the error action never gets fired. Even though it works, I'm super confused now.

@bantic
Copy link
Member

bantic commented Jan 19, 2016

@constantm Can you share any code? This addon should work (insofar as it adds the airbrake client code, adds window.onerror and Ember.onerror handlers that report to airbrake, and exposes an 'airbrake' service when installed) for Ember 1.13.x as of the latest version (0.1.0).
In Ember 1.13, errors in route transitions do not fire Ember.onerror, but they do fire an "error" action if it exists, so for Ember 1.13.x you would want to add an "error" action in an appropriate route (the application route, most likely, which is where an error in any route would eventually bubble to), and use the airbrake service to explicitly notify at that spot.
Does that help clear it up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants