mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-24 09:54:31 +02:00
Show more detailed error on invalid JSON, closes #532
This commit is contained in:
parent
a256d7de98
commit
e4ed372517
2 changed files with 7 additions and 5 deletions
|
|
@ -994,9 +994,11 @@ def insert_upsert_implementation(
|
|||
docs = json.load(decoded)
|
||||
if isinstance(docs, dict):
|
||||
docs = [docs]
|
||||
except json.decoder.JSONDecodeError:
|
||||
except json.decoder.JSONDecodeError as ex:
|
||||
raise click.ClickException(
|
||||
"Invalid JSON - use --csv for CSV or --tsv for TSV files"
|
||||
"Invalid JSON - use --csv for CSV or --tsv for TSV files\n\nJSON error: {}".format(
|
||||
ex
|
||||
)
|
||||
)
|
||||
if flatten:
|
||||
docs = (_flatten(doc) for doc in docs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue