Skip to content

Commit ff5636b

Browse files
committed
Merge pull request #4198 from machty/redirect-hook-fix
[BUGFIX beta] Sync router.js, fix redirect issue
2 parents 5b09bd5 + ea2a77c commit ff5636b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/ember-routing/lib/vendor/router.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ define("router/router",
837837
if (!(e instanceof TransitionAborted)) {
838838
//var erroneousHandler = handlerInfos.pop();
839839
var infos = transition.state.handlerInfos;
840-
transition.trigger(true, 'error', e, transition, infos[infos.length-1]);
840+
transition.trigger(true, 'error', e, transition, infos[infos.length-1].handler);
841841
transition.abort();
842842
}
843843

@@ -1283,9 +1283,12 @@ define("router/transition-state",
12831283
function handleError(error) {
12841284
// This is the only possible
12851285
// reject value of TransitionState#resolve
1286+
var handlerInfos = currentState.handlerInfos;
1287+
var errorHandlerIndex = payload.resolveIndex >= handlerInfos.length ?
1288+
handlerInfos.length - 1 : payload.resolveIndex;
12861289
throw {
12871290
error: error,
1288-
handlerWithError: currentState.handlerInfos[payload.resolveIndex].handler,
1291+
handlerWithError: currentState.handlerInfos[errorHandlerIndex].handler,
12891292
wasAborted: wasAborted,
12901293
state: currentState
12911294
};

0 commit comments

Comments
 (0)