Skip to content

Commit

Permalink
WTH exception handling (#1)
Browse files Browse the repository at this point in the history
* fix the `wth` exception

* add comment for the wth error

* fix indentation
  • Loading branch information
prageeth committed Jul 18, 2021
1 parent dc79f6f commit e6d058a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ export const getWorkingPath = (parentRouterId) => {
}
const stackEntry = stack[parentRouterId];
if (!stackEntry) {
// this should not be reached at all
throw 'wth';
}

Expand Down Expand Up @@ -239,6 +240,10 @@ const process = (stackObj, directCall) => {
reducedPath: previousReducedPath
} = stackObj;

if (!stack[routerId]) {
return;
}

const currentPath = getWorkingPath(parentRouterId);
let route = null;
let targetFunction = null;
Expand Down Expand Up @@ -270,10 +275,6 @@ const process = (stackObj, directCall) => {
break;
}

if (!stack[routerId]) {
return;
}

if (!anyMatched) {
route = null;
targetFunction = null;
Expand Down

0 comments on commit e6d058a

Please sign in to comment.