Skip to content
Open
Changes from all commits
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
12 changes: 11 additions & 1 deletion sherlock_project/sherlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,17 @@ def main():
f"\n{latest_release_json['html_url']}"
)

except Exception as error:
except (requests.RequestException, ValueError, KeyError) as error:
# requests.get() raises requests.RequestException (and its concrete
# subclasses ConnectionError, Timeout, HTTPError) for network and
# transport failures; json_loads() raises json.JSONDecodeError (a
# ValueError subclass) for malformed JSON; and the ["tag_name"] /
# latest_remote_tag[1:] lookups raise KeyError / IndexError for
# unexpected payload shapes. Catching the bare Exception was
# masking KeyboardInterrupt during a Ctrl-C just after the version
# check and turning any unrelated bug (a typo in forge_api_latest_release,
# an unhandled unicode issue in latest_release_raw) into a confusing
# 'A problem occurred while checking for an update' line on stderr.
print(f"A problem occurred while checking for an update: {error}")

# Make prompts
Expand Down