protonmail: log failed requests
This commit is contained in:
parent
4b6614ca26
commit
4c2066d28f
|
@ -11,6 +11,8 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"golang.org/x/crypto/openpgp"
|
"golang.org/x/crypto/openpgp"
|
||||||
|
|
||||||
|
"log"
|
||||||
)
|
)
|
||||||
|
|
||||||
const Version = 3
|
const Version = 3
|
||||||
|
@ -75,6 +77,8 @@ func (c *Client) newRequest(method, path string, body io.Reader) (*http.Request,
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//log.Printf(">> %v %v\n", method, path)
|
||||||
|
|
||||||
req.Header.Set("X-Pm-Appversion", c.AppVersion)
|
req.Header.Set("X-Pm-Appversion", c.AppVersion)
|
||||||
req.Header.Set(headerAPIVersion, strconv.Itoa(Version))
|
req.Header.Set(headerAPIVersion, strconv.Itoa(Version))
|
||||||
c.setRequestAuthorization(req)
|
c.setRequestAuthorization(req)
|
||||||
|
@ -155,6 +159,7 @@ func (c *Client) doJSON(req *http.Request, respData interface{}) error {
|
||||||
|
|
||||||
if maybeError, ok := respData.(maybeError); ok {
|
if maybeError, ok := respData.(maybeError); ok {
|
||||||
if err := maybeError.Err(); err != nil {
|
if err := maybeError.Err(); err != nil {
|
||||||
|
log.Printf("request failed: %v %v: %v", req.Method, req.URL.String(), err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue