Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion tools/precompiler/precompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ async def _process_request(self, request: "JsonWorkRequest") -> None:
# We don't send a response because we assume the request that
# triggered cancelling sent the response
raise
except:
except Exception:
_logger.exception("Unhandled error: request=%s", request)
self._send_response(
{
Expand Down
2 changes: 1 addition & 1 deletion tools/private/update_deps/update_pip_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def _get_deps(report: dict) -> list[Dep]:
url=dep["download_info"]["url"],
sha256=dep["download_info"]["archive_info"]["hash"][len("sha256=") :],
)
except:
except Exception:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While except Exception: is an improvement over a bare except:, it's best practice to be as specific as possible with the exceptions being caught. The code in the try block primarily performs dictionary lookups, so the expected exceptions are KeyError or TypeError. Catching these specific exceptions will prevent masking other unexpected errors.

Suggested change
except Exception:
except (KeyError, TypeError):

debug_dep = textwrap.indent(json.dumps(dep, indent=4), " " * 4)
print(f"Could not parse the response from 'pip':\n{debug_dep}")
raise
Expand Down