Prevent exceptions thrown from 'compatibility mode' routes from being silently caught, disabling compatibility mode #815
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We automatically ‘enable’ compatibility mode if the file
app/v6/routes.js
exists.We currently do this by including it within a try/catch block, relying on the empty catch block handling the case where the file does not exist.
However this means that if any exception is encountered whilst requiring that file, we silently fail and do not enable compatibility mode.
This means that if e.g. a user’s v6 routes file includes a dependency which is not installed (which is likely if the user is trying to update their prototype, as doing so nukes any additional dependencies in their
package.json
file) then this error will not be reported and compatibility mode just won’t work.Instead, we test for the presence of
app/v6/routes.js
– if it exists, then we require it. If any exception is encountered in doing so, it’ll be thrown as expected.Fixes #799