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

invalid configuration leads to crash #60

Open
mwermelinger opened this issue Feb 13, 2024 · 1 comment
Open

invalid configuration leads to crash #60

mwermelinger opened this issue Feb 13, 2024 · 1 comment
Assignees
Labels
effort: medium These issues require some work priority: high type: error Bug in the code, typo or omission in the docs, etc.

Comments

@mwermelinger
Copy link
Member

mwermelinger commented Feb 13, 2024

If the configuration file is not valid JSON or if it doesn't include a LANGUAGE entry, then the program crashes. Tests need to be added.

While one could proceed with a missing LANGUAGE and simply report all constructs as disallowed, it's less baffling and more useful to report an error and exit.

Ideally, the JSON 'schema' should be checked and not just whether it has a LANGUAGE key. Is there a way?

@mwermelinger mwermelinger added type: error Bug in the code, typo or omission in the docs, etc. priority: high effort: medium These issues require some work labels Feb 13, 2024
@mwermelinger mwermelinger self-assigned this Feb 13, 2024
@mwermelinger
Copy link
Member Author

There is a JSON Schema specification that can be validated by jsonschema but I didn't look into details, e.g. how to specify that an object has integer keys. I used https://jsonschema.net to generate a schema from m269.json but it made each unit a mandatory property of each object, i.e. the schema included units 1, 2, 4, 8, etc. (whatever the JSON file had).

Given that in future we may move to TOML, which is easier to type and allows comments, it may be wise not to invest much effort into this.

mwermelinger added a commit that referenced this issue Feb 13, 2024
Send all messages to stdout to ease testing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: medium These issues require some work priority: high type: error Bug in the code, typo or omission in the docs, etc.
Projects
None yet
Development

No branches or pull requests

1 participant