Commit 8b41fb8
committed
ngclient: propagate non-timeout urllib3 connection errors
Urllib3Fetcher._fetch caught MaxRetryError and only re-raised it (as
SlowRetrievalError) when the reason was a timeout. For any other reason,
such as a TLS certificate error, it fell through to the response.status
check with response still unbound, so the caller saw an UnboundLocalError
instead of the real connection error.
Re-raise the original error when the reason is not a timeout, so fetch()
wraps the meaningful error in a DownloadError as documented. Add a
regression test covering a non-timeout MaxRetryError.
Signed-off-by: arpitjain099 <arpitjain099@gmail.com>1 parent 3197848 commit 8b41fb8
2 files changed
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
140 | 159 | | |
141 | 160 | | |
142 | 161 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
85 | 88 | | |
86 | 89 | | |
87 | 90 | | |
| |||
0 commit comments