Financial-Times/dotcom-page-kit

Fetching subnavigation can fail loudly in navigation middleware

i-like-robots opened this issue · 0 comments

Currently if the enableSubnavigation option is on when implementing the navigation middleware package it will error if the requested page cannot be found within the navigation heiarchy:

{
  "type": "Uncaught Error",
  "error": {
    "name": "NotFoundError",
    "message": "Sub-navigation for stream/82645c31-4426-4ef5-99c9-9df6e0940c00 could not be found.",
    "stack": [
      "NotFoundError: Sub-navigation for stream/82645c31-4426-4ef5-99c9-9df6e0940c00 could not be found.",
      "    at Navigation.getSubNavigationFor (/Users/matt.hinchliffe/Projects/apps/next-stream-page/node_modules/@financial-times/dotcom-server-navigation/dist/node/navigation.js:59:40)",
      "    at process._tickCallback (internal/process/next_tick.js:68:7)"
    ]
  }
}

This is likely to be a common event as we have ~80,000 concept pages and not nearly so many links in our navigation! We should update our implementation to fail silently as this is not critical.