Skip to content

Commit

Permalink
fix(router): log helpful error on missing viewport
Browse files Browse the repository at this point in the history
When a route does not configure all available viewports, the navigation plan will crash. Now, the navigation plan will log a helpful error with the missing viewport and the affected route.

Fixes #241.
  • Loading branch information
jwahyoung committed Feb 13, 2016
1 parent 372ae81 commit a46287f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/navigation-plan.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export function _buildNavigationPlan(instruction: NavigationInstruction, forceLi
for (let viewPortName in prev.viewPortInstructions) {
let prevViewPortInstruction = prev.viewPortInstructions[viewPortName];
let nextViewPortConfig = config.viewPorts[viewPortName];

if (nextViewPortConfig == null) throw new Error(`Invalid Route Config: Configuration for viewPort "${viewPortName}" was not found for route: "${instruction.config.route}."`);

let viewPortPlan = plan[viewPortName] = {
name: viewPortName,
config: nextViewPortConfig,
Expand Down

0 comments on commit a46287f

Please sign in to comment.