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

commentjson raises the wrong error type on trailing comma #43

Closed
EliRibble opened this issue Jun 19, 2020 · 1 comment
Closed

commentjson raises the wrong error type on trailing comma #43

EliRibble opened this issue Jun 19, 2020 · 1 comment

Comments

@EliRibble
Copy link

For example, let's say commentjson is told to load the following:

{
  // there is a trailing comma below
  "c": 1,
}

This will be caught on commentjson.py:170 as a lark.exceptions.UnexpectedCharacters exception. That seems reasonable. Unfortunately, commentjson.py:205 will then catch this as a generic Exception and translate it into a JSONLibraryException(e). This is bad because it breaks API-compatibility with the Python json library, which would just raise a ValueError

@vaidik
Copy link
Owner

vaidik commented Oct 5, 2020

Not fixing this directly. Instead of that support for trailing commas is being added to expand use-cases for commentjson.

@vaidik vaidik closed this as completed in 5ab5d14 Oct 5, 2020
vaidik added a commit that referenced this issue Oct 5, 2020
Ignore trailing commas (closes #39, closes #43)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants