Commit ca16167
refactor: eliminate duplicated wheel server retry loop
BootstrapRequirementResolver._resolve() and wheels.resolve_prebuilt_wheel()
both implemented the "try each wheel server until one succeeds" pattern with
different error handling:
- Bootstrap path caught narrow exceptions (ResolverException | NoSuchProjectError)
and raised ValueError with no exception details
- Wheel path caught broad Exception and raised ExceptionGroup with collected errors
This inconsistency meant:
- Different exception types were swallowed in different code paths
- Bootstrap path lost exception details (no ExceptionGroup)
- Callers couldn't distinguish failure types
Solution:
- Created resolve_all_prebuilt_wheels() that returns all matching versions
- Made resolve_prebuilt_wheel() call it and return first result
- Made bootstrap resolver use resolve_all_prebuilt_wheels()
- Now both code paths use consistent ExceptionGroup-based error handling
Benefits:
- Single source of truth for wheel server retry logic
- Consistent exception handling across all resolution paths
- Better error reporting with ExceptionGroup containing details from all servers
- Reduces code duplication by ~20 lines
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Rohan Devasthale <rdevasth@redhat.com>1 parent 1bb213c commit ca16167
2 files changed
Lines changed: 35 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | 12 | | |
15 | 13 | | |
16 | 14 | | |
| |||
155 | 153 | | |
156 | 154 | | |
157 | 155 | | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
179 | 162 | | |
180 | 163 | | |
181 | 164 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
485 | 485 | | |
486 | 486 | | |
487 | 487 | | |
488 | | - | |
489 | | - | |
| 488 | + | |
490 | 489 | | |
491 | 490 | | |
492 | 491 | | |
493 | 492 | | |
494 | 493 | | |
495 | | - | |
496 | | - | |
| 494 | + | |
| 495 | + | |
497 | 496 | | |
498 | | - | |
499 | | - | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
500 | 501 | | |
501 | 502 | | |
502 | 503 | | |
| |||
509 | 510 | | |
510 | 511 | | |
511 | 512 | | |
512 | | - | |
513 | | - | |
514 | | - | |
| 513 | + | |
515 | 514 | | |
516 | 515 | | |
517 | 516 | | |
518 | 517 | | |
519 | 518 | | |
520 | 519 | | |
521 | 520 | | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
0 commit comments