Closed rluba closed 6 years ago
I had a vague feeling I was missing something, but I couldn't spot it. Of course it's child routers.
I'll try to beef up the test coverage in this area before having another crack at this. Thanks for investigating this further, your information helps a lot.
@jdanyow I agree with him, the original bug is much "better" than the new bug.
With the changes in this PR it’s better than both the original state (because there are no warnings for redirects in app routers) and the current state (because there are no exceptions for redirects in child routers). So I think it’s worth merging instead of reverting 487c33d5.
@jdanyow @EisenbergEffect Please merge this. I broke production apps with this (sorry about that!). See https://github.com/aurelia/router/issues/480
This causes #480 to re-appear until a better handling for cancellations exists – but it’s still better than the errors caused by improper handling of redirects at the moment.
There’s no easy way to call
next.cancel
from all places that can create a redirect. I’d suggest changing redirects to add a magic value to anError
(eg.error.redirect = new Redirect(…)
) and rejecting with that.But this would require changes in several places that check for
output instanceof Error
to determine the kind of result.