Ember swallowing errors


Would anyone know why ember would swallow errors?

Every time I’ve had an error lately it just failed silently. For example, earlier I had a simple helper that wasnt expecting an undefined value and it caused the whole template to not render. I tried recreating it in a jsbin and in a new app and I couldnt.

Just now I screwed up an inline link-to by swapping the order of the text and the route. That too caused the whole app to fail and not render. But not a single error was thrown in the console.

Any ideas on how this can happen?


It can happen if you’ve implemented the Ember.onError hook. This allows apps to manage their own error handling. See: http://guides.emberjs.com/v2.2.0/configuring-ember/debugging/#toc_implement-an-ember-onerror-hook-to-log-all-errors-in-production


Once upon a time I had played around with that call but have since deleted it. Searched through the built file and still done have any onError calls.


One thing you could try is opening “ember.debug.js” in your chrome debugger (P shortcut) and put a breakpoint in the onerrorDefault function. Then try doing something that will generate an error and see if the breakpoint hits. If so, walk the code and see why the logging at the bottom of that function isn’t hitting. If the breakpoint doesn’t hit, it might be a promise somewhere along the way that is swallowing the error. Also it’s worth noting that if the error happens as part of a transition, the error would be sent to the router as an error event.


So i tinkered around a bit. I added error action events to three routes I’m working on, as well as added a .then() to catch any promise error on that route. I added a non-existant component to the template to break things but it still didnt throw an error, and it didnt hit the breakpoint in ember.debug.