Unhandledrejection in ember

Hello, this might be a very tricky question to answer but we have like 500k of those in rollbar, (we have millions of users so even if this number appears high it only affects a little percentage)

"[unhandledrejection] error getting `reason` from event"

These happen mainly on mobile devices and I can’t really place them. Does anyone what happens here. I checked https://developer.mozilla.org/en-US/docs/Web/API/Window/unhandledrejection_event but I am wondering if ember can help with this.

Cheers Thomas

update: looks like we have some action code which does not catch errors as from failed ajax requests.

Is there no additional stack trace info that helps track it down?

Yeah we sort of tracked it down to an ember-ajax call which has a catch statement to ignore AbortErrors and other errors are thrown again.

  if(isAbortError(e)) return
  throw e

Looks like we dont handle the thrown error < what an oversight.

I am little unsure though why our global error logger isnt triggering. I just looked it up and amber-ajax is using RSVP promises. So RSVP.on('error') should log any issues but it doesn’t.

UPDATE: looks like the - didTransition hook is not included in the error handling of the route. Therefor it is crucial to try catch any code you execute in that hook. The combination of actions not being handled result in the bugs we see in rollbar. Still assumptions which need to be proven on prod.

unhandledrejection is triggered by uncaught native promises rejections. They are outside Ember’s RSVP promises (RSVP.on(‘error’) goes through window.onerror). You need to check the places you use native promises, or 3rd party libs that run async code outside Ember’s runloops.

Yeah we are cracking down a lot of those. Thanks