mirror of
https://github.com/matrix-org/gomatrix
synced 2025-06-07 07:13:23 +00:00
Merge pull request #20 from matrix-org/rxl881/errorLogging
Log response body when content upload fails
This commit is contained in:
commit
f683c3da34
1 changed files with 8 additions and 1 deletions
|
@ -556,8 +556,15 @@ func (cli *Client) UploadToContentRepo(content io.Reader, contentType string, co
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if res.StatusCode != 200 {
|
if res.StatusCode != 200 {
|
||||||
|
contents, err := ioutil.ReadAll(res.Body)
|
||||||
|
if err != nil {
|
||||||
return nil, HTTPError{
|
return nil, HTTPError{
|
||||||
Message: "Upload request failed",
|
Message: "Upload request failed - Failed to read response body: " + err.Error(),
|
||||||
|
Code: res.StatusCode,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil, HTTPError{
|
||||||
|
Message: "Upload request failed: " + string(contents),
|
||||||
Code: res.StatusCode,
|
Code: res.StatusCode,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue