Error route must now be explicitly included in router- intended behavior?


#1

Hey,

We just upgraded from Ember 1.3 to 1.9, and we’re experiencing interesting new behavior with the error route.

The ember inspector displayed the error route as existing, but we were unable to visit it at /error, and transitioning to it did not work. However, when we added this.route(‘error’) to router.js, it worked again. . We did not have to do this for loading states.

Is this new behavior intended, a known ember bug, or a bug in our codebase?


#2

The default error routes intentionally don’t have URLs. (Well, technically they do, but those URLs are deliberately ones you wouldn’t hit by accident, like: _unused_dummy_error_path_route_application.) That’s why you can’t get there via /error unless you create your own error route explicitly.

You should be able to transitionTo error routes, but keep in mind they expect one argument (the error). Also you probably don’t really want the above URL to appear, so the right way is to use intermediateTransitionTo, like this:

router.intermediateTransitionTo('error', new Error('oh no!'))