mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
fix(downloads): handle panic in error check (#1782)
This commit is contained in:
parent
f89ea9e2ff
commit
d23e7ffca6
1 changed files with 9 additions and 1 deletions
|
@ -9,6 +9,7 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/cookiejar"
|
"net/http/cookiejar"
|
||||||
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -189,9 +190,16 @@ func retryableRequest(httpClient *http.Client, req *http.Request, r *domain.Rele
|
||||||
// Get the data
|
// Get the data
|
||||||
resp, err := httpClient.Do(req)
|
resp, err := httpClient.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.As(err, net.OpError{}) {
|
var opErr *net.OpError
|
||||||
|
if errors.As(err, &opErr) {
|
||||||
return retry.Unrecoverable(errors.Wrap(err, "issue from proxy"))
|
return retry.Unrecoverable(errors.Wrap(err, "issue from proxy"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var urlErr *url.Error
|
||||||
|
if errors.As(err, &urlErr) {
|
||||||
|
return retry.Unrecoverable(errors.Wrap(err, "url parse error"))
|
||||||
|
}
|
||||||
|
|
||||||
return errors.Wrap(err, "error downloading file")
|
return errors.Wrap(err, "error downloading file")
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue