xlwings/jsondiff

When giving a file that is not JSON, there's traceback output

doctordesh opened this issue · 4 comments

Hi, thanks for a good tool. I like it!

However, this happens from time to time, that I use it with a file that is not a JSON. This is caused by a typo or other human error.

> jdiff file-a.json file-b.json 
Traceback (most recent call last):
  File "/opt/conda/bin/jdiff", line 8, in <module>
   ...
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I think that the end user should never have to see a traceback. Wrapping this call into a try-except block to just output that file-a.json is not a valid JSON file is a resonable quality-of-life improvement. I'm a developer and understand the traceback, but someone who is not as technically savvy will not necessarily understand the quite cryptic JSONDecodeError message.

All the best

I think this is a reasonable request. How does #72 look to you?

The API surface is a bit awkward to not break but this should be sufficient.

#72 looks good!

Hey @corytodd thanks! Would you be up for becoming an official maintainer of jsondiff?

Absolutely @fzumstein, happy to help :)