Skip to content

Commit 9c7547f

Browse files
vitkyrkaclaude
andcommitted
velero: narrow replay_collector_blobs's except to JSONDecodeError
json.loads() on a str only ever raises JSONDecodeError for malformed input; the broad except Exception also swallowed anything unexpected (e.g. a TypeError or MemoryError) and re-labeled it as an "Error loading json" ValueError, which would mislead whoever debugs it. Catch the specific decode error so genuinely unexpected failures propagate untouched. Environment: Datadog workspace Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent a42f52a commit 9c7547f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • datadog_checks_dev/datadog_checks/dev

datadog_checks_dev/datadog_checks/dev/_env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def replay_collector_blobs(matches: list[str], stub_aggregator: Any, stub_agent:
137137
for raw_json in matches:
138138
try:
139139
collector = json.loads(raw_json)
140-
except Exception as e:
140+
except json.JSONDecodeError as e:
141141
raise ValueError(f'Error loading json: {e}\nCollector Json Output:\n{raw_json}') from e
142142
replay_check_run(collector, stub_aggregator, stub_agent)
143143

0 commit comments

Comments
 (0)