Skip to content

Commit baa360d

Browse files
Don't crash on an UnexpectedSituation (#2453)
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.
1 parent d7dfbc0 commit baa360d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/datafix/reimport_gcs_record.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,12 @@ def main() -> None:
171171
try:
172172
with ds_client.transaction() as xact:
173173
for bug in result_to_fix:
174-
bug_in_gcs = objname_for_bug(ds_client, bug)
174+
try:
175+
bug_in_gcs = objname_for_bug(ds_client, bug)
176+
except UnexpectedSituation as e:
177+
if args.verbose:
178+
print(f"Skipping {bug['db_id']}, got {e}\n")
179+
continue
175180
if args.verbose:
176181
print(f"Resetting creation time for {bug_in_gcs['uri']}")
177182
if not args.dryrun:

0 commit comments

Comments
 (0)