1
0
mirror of https://github.com/DNSCrypt/dnscrypt-proxy.git synced 2024-12-29 00:30:30 +01:00

change: xtransport: Return http response status string as error, do name make own string

This gives much better possibilities to diagnose problems than error
message with only "informative" part being 500.
This commit is contained in:
Markus Linnala 2019-10-16 12:49:18 +03:00 committed by Frank Denis
parent 72681725b1
commit df03065eaf

View File

@ -272,7 +272,7 @@ func (xTransport *XTransport) Fetch(method string, url *url.URL, accept string,
if resp == nil {
err = errors.New("Webserver returned an error")
} else if resp.StatusCode < 200 || resp.StatusCode > 299 {
err = fmt.Errorf("Webserver returned code %d", resp.StatusCode)
err = errors.New(resp.Status)
}
} else {
(*xTransport.transport).CloseIdleConnections()