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

Give better error message (and don't crash) if bad json in the cache #6277

Merged
merged 5 commits into from
Feb 7, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions mypy/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,11 +828,11 @@ def _load_json_file(file: str, manager: BuildManager,
try:
result = json.loads(data)
except ValueError: # TODO: JSONDecodeError in 3.5
manager.errors.report(0, 0, "Error reading JSON file {file};"
manager.errors.set_file(file, None)
manager.errors.report(0, 0, "Error reading JSON file;"
ethanhs marked this conversation as resolved.
Show resolved Hide resolved
" you likely have a bad cache.\n"
" Try removing the {cache_dir} directory"
"Try removing the {cache_dir} directory"
" and run mypy again.".format(
file=file,
cache_dir=manager.options.cache_dir
),
blocker=True)
Expand Down