Commit 3b9945a
Zo Bot
narrow status() and benchmark send() exception handlers in cli/main.py
status() makes one httpx.get and one resp.json() call. The narrow set
(httpx.RequestError, json.JSONDecodeError) covers everything that can
go wrong: RequestError covers connection refused, DNS failure, and
timeout (TimeoutException is a RequestError subclass); JSONDecodeError
covers a non-JSON response body from the local FreeRelay server.
TyperExit is raised after the handler returns, KeyboardInterrupt and
SystemExit now propagate to the caller instead of being converted to
"FreeRelay not running" message and an exit code 1.
The benchmark send() closure only awaits client.post() and inspects
the status code. RequestError covers connection refused, timeout, and
DNS failure; status codes >= 400 are handled by the existing
`if r.status_code == 200` branch and don't raise. The old bare
except was also swallowing KeyboardInterrupt during a long benchmark
run.
Added `import json` at the top so json.JSONDecodeError is reachable
without inline-import gymnastics.1 parent ec9d17f commit 3b9945a
1 file changed
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
185 | 186 | | |
186 | 187 | | |
187 | 188 | | |
188 | | - | |
| 189 | + | |
189 | 190 | | |
190 | 191 | | |
191 | 192 | | |
| |||
242 | 243 | | |
243 | 244 | | |
244 | 245 | | |
245 | | - | |
| 246 | + | |
246 | 247 | | |
247 | 248 | | |
248 | 249 | | |
| |||
0 commit comments