mirror of
https://github.com/onedr0p/exportarr.git
synced 2026-02-06 10:57:32 +00:00
Add detail about HTTP error messages
* resp.Status includes both the code and the textual description * If Location is available (i.e. this is a redirect), show it
This commit is contained in:
parent
6304d91c26
commit
e996f0b201
@ -86,7 +86,10 @@ func (c *Client) DoRequest(endpoint string, target interface{}) error {
|
||||
return err
|
||||
}
|
||||
if !(resp.StatusCode >= 200 && resp.StatusCode < 300) {
|
||||
errMsg := fmt.Sprintf("An error has occurred during retrieving statistics HTTP statuscode %d", resp.StatusCode)
|
||||
errMsg := fmt.Sprintf("An error has occurred during retrieving statistics HTTP status %s", resp.Status)
|
||||
if location := resp.Header.Get("Location"); location != "" {
|
||||
errMsg += " (Location: " + location + ")"
|
||||
}
|
||||
log.Fatal(errMsg)
|
||||
return errors.New(errMsg)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user