nhsuk / nhsuk-prototype-kit-version-one

NHSUK Prototype Kit
https://nhsuk-prototype-kit.herokuapp.com/
MIT License
2 stars 3 forks source link

Certain classes of error appear to get swallowed. #36

Closed neilbmclaughlin closed 6 years ago

neilbmclaughlin commented 6 years ago

I added a require to a 'code behind' file to load a local module and got the path wrong. No console errors appeared when running locally and the application loaded the page but the code behind hadn't run so the page was missing data.

This can be replicated by adding a require to a non existing package in any code behind file. This may also occur with other classes of error.

I managed to resolve the problem but wanted to log it.

paul-mitchell-bjss commented 6 years ago

I think this is caused by the following code in app/routes/prototypes.js

    try {
      handler = require(`../views/${req.params.prototype}.js`)
    } catch (e) {}

which was intended to suppress errors when a template does not have a code-behind file. The catch block will need to be more discriminatory.