Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The CLI crashes in watch mode when suppression files are incorrect JSON #117

Open
jfmengels opened this issue Apr 17, 2023 · 0 comments
Open
Labels
bug Something isn't working help wanted We could use your help

Comments

@jfmengels
Copy link
Owner

Ideally we don't want to crash in that case, we just want to report an error and wait for the file to be valid again.

To reproduce:

  • Run elm-review --watch on a project with suppressed errors
  • Changed one of the suppressed files to invalid JSON
  • Expect to see an error like below:
-- UNEXPECTED ERROR ------------------------------------------------------------

I ran into an unexpected error. Please open an issue at the following link:
  https://github.com/jfmengels/node-elm-review/issues/new

Please include this error message and as much detail as you can provide. If you
can, please provide a setup that makes it easy to reproduce the error. That will
make it much easier to fix the issue.

Below is the error that was encountered.
--------------------------------------------------------------------------------
SyntaxError: /Users/jengels/dev/humio/ui/review/suppressed/NoDeprecated.json: Unexpected token , in JSON at position 571
    at JSON.parse (<anonymous>)
    at _readFile (/Users/jengels/dev/my-project/ui/node_modules/jsonfile/index.js:25:16)

This might happen if someone touches the JSON file, or during a Git rebase when there are conflicts in a suppression file.

Expected bhevaior

In the same conditions, the CLI should not crash. It should show a nice error indicating that a suppressed errors file is invalid. Once that file is fixed, it should resume working like before.

@jfmengels jfmengels added bug Something isn't working help wanted We could use your help labels Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted We could use your help
Projects
None yet
Development

No branches or pull requests

1 participant