Repository navigation
Commit 6636d77
committed
fix(#3109): catch httpx.HTTPStatusError in Watsonx model discovery
WatsonxIAMAuth.raise_for_status() raises httpx.HTTPStatusError on
IAM token exchange failures (401/403/5xx), which is not a subclass
of openai.APIError. This escaped the except clause in
_discover_models, propagating unwrapped instead of as
ModelDiscoveryError.
Widen the except tuple to (APIError, httpx.HTTPStatusError) so IAM
failures are wrapped consistently with other discovery errors.
Add a parametrized test case for httpx.HTTPStatusError to the
existing test_discover_models_wraps_api_error test.
Closes #31091 parent 0b7d213 commit 6636d77
2 files changed
Lines changed: 8 additions & 2 deletions
File tree
- src/providers/inference/watsonx
- tests/unit/providers/inference/watsonx
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
66 | | - | |
| 67 | + | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
131 | 136 | | |
132 | | - | |
| 137 | + | |
133 | 138 | | |
134 | 139 | | |
135 | 140 | | |
| |||
0 commit comments