When an error occurs in a nested route, the thrown error bubbles up to parent routes until one of them catches it.
The root level that can handle an error is Application
's. However, the setupController
hook of ApplicationRoute
is triggered after transitioning from ErrorRoute
with an undefined
context.
Code example can be viewed here: http://jsbin.com/ucanam/2563/edit (output is given in the console)
Why does ApplicationRoute
lose its initial model?
model is passed to setupController for ErrorRoute
ErrorRoute
’s model is the error object, not Application
’s.
How can I still be able to use the model resolved by ApplicationRoute
’s model
hook?
Since it’s been reset after the ErrorRoute
is called, further navigation in the app results in an undefined
application model.