mirror of
https://github.com/K-Dense-AI/scientific-agent-skills.git
synced 2026-12-03 17:04:10 +08:00
fix(simpy): report a non-UTF-8 resource CSV as unreadable, not as a bad integer (#259)
UnicodeError is a ValueError subclass, so the 'invalid integer' handler was catching decode failures first. Swap the two except clauses so a non-UTF-8 CSV is reported as unreadable.
This commit is contained in:
1 parent
34ad8b73bf
commit
cfefe8b84f
1 file changed
+2
-2
@@ -199,10 +199,10 @@ def summarize_resource_csv(path: Path, *, max_records: int) -> dict[str, Any]:
|
||||
}
|
||||
)
|
||||
event_counts[event] += 1
|
||||
except ValueError as exc:
|
||||
raise CliError(f"resource CSV contains an invalid integer: {exc}") from exc
|
||||
except (OSError, UnicodeError, csv.Error) as exc:
|
||||
raise CliError(f"cannot read resource CSV {path.name}: {exc}") from exc
|
||||
except ValueError as exc:
|
||||
raise CliError(f"resource CSV contains an invalid integer: {exc}") from exc
|
||||
if len(samples) < 2:
|
||||
raise CliError("resource CSV needs at least an initial and final sample")
|
||||
start = samples[0]["time"]
|
||||
|
||||
Reference in new issue
Block a user