Skip to content

Commit

Permalink
Don't crash on an UnexpectedSituation (#2453)
Browse files Browse the repository at this point in the history
Rather than crash and prematurely end an invocation with potentially
more bugs left to process, gracefully handle `UnexpectedSituation`
exceptions and continue processing the rest of the bugs.

Necessary because there are still some Git-sourced CVEs in Datastore
that require reimporting from GCS, and tickle this edge case.
  • Loading branch information
andrewpollock authored Aug 6, 2024
1 parent d7dfbc0 commit baa360d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/datafix/reimport_gcs_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,12 @@ def main() -> None:
try:
with ds_client.transaction() as xact:
for bug in result_to_fix:
bug_in_gcs = objname_for_bug(ds_client, bug)
try:
bug_in_gcs = objname_for_bug(ds_client, bug)
except UnexpectedSituation as e:
if args.verbose:
print(f"Skipping {bug['db_id']}, got {e}\n")
continue
if args.verbose:
print(f"Resetting creation time for {bug_in_gcs['uri']}")
if not args.dryrun:
Expand Down

0 comments on commit baa360d

Please sign in to comment.