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

When an error occurs better diagnostics should be displayed #586

Open
twekberg opened this issue Mar 23, 2023 · 2 comments
Open

When an error occurs better diagnostics should be displayed #586

twekberg opened this issue Mar 23, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@twekberg
Copy link

What did you do?

I used ujson.load to load a file. It generated this message:
ValueError: Value is too big!
because one of the values was an integer that had 388 6's (i.e. 666666...).

What did you expect to happen?

It would be nice to have the diagnostic displayed with the character or line number in the file where the error was detected.

What actually happened?

Only an 'I got an error somewhere' type of a diagnostic.
It took several hours to determine where the problem was. The file size was 6.3MB.

What versions are you using?

  • OS: Ubuntu 20.04
  • Python: 3.8.10
  • UltraJSON: 5.1.0

Please include code that reproduces the issue.

>>> import ujson
>>> print(ujson.__version__)
5.1.0
>>> t='[,]'
>>> ujson.loads(t)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Expected object or value

The same diagnostic is generated for ujson 5.7.0.

@bwoodsend bwoodsend added the enhancement New feature or request label Mar 23, 2023
@bwoodsend
Copy link
Collaborator

Character numbers should be fairly doable.

@bwoodsend
Copy link
Collaborator

That said, a dumb grep -P '\d{100,}' file.json would have found the issue instantly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants