Commit 9501f27
committed
chore: improve metadata service error handling
Distinguish between retry exhaustion due to exceptions and retry exhaustion due to retryable status codes.
- Use `last_exception` to track the most recent exception.
- Clear `last_exception` on successful response (even if status is retryable).
- Raise TransportError chained from `last_exception` if available.
- Otherwise raise TransportError with response status and details.
- Update tests to match new error format.1 parent 1406f44 commit 9501f27
File tree
2 files changed
+24
-14
lines changed- google/auth/compute_engine
- tests/compute_engine
2 files changed
+24
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
297 | | - | |
| 297 | + | |
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
| |||
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
| 311 | + | |
316 | 312 | | |
317 | 313 | | |
| 314 | + | |
318 | 315 | | |
319 | 316 | | |
320 | 317 | | |
| |||
325 | 322 | | |
326 | 323 | | |
327 | 324 | | |
328 | | - | |
| 325 | + | |
329 | 326 | | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
334 | 345 | | |
335 | | - | |
336 | 346 | | |
337 | 347 | | |
338 | 348 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
410 | | - | |
| 410 | + | |
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
| |||
426 | 426 | | |
427 | 427 | | |
428 | 428 | | |
429 | | - | |
| 429 | + | |
430 | 430 | | |
431 | 431 | | |
432 | 432 | | |
| |||
0 commit comments