File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,9 +27,10 @@ var _ error = ErrUnexpectedStatus{}
2727
2828// ErrUnexpectedStatus is returned if a registry API request returned with unexpected HTTP status
2929type ErrUnexpectedStatus struct {
30- Status string
31- StatusCode int
32- Body []byte
30+ Status string
31+ StatusCode int
32+ Body []byte
33+ RequestURL , RequestMethod string
3334}
3435
3536func (e ErrUnexpectedStatus ) Error () string {
@@ -42,5 +43,14 @@ func NewUnexpectedStatusErr(resp *http.Response) error {
4243 if resp .Body != nil {
4344 b , _ = ioutil .ReadAll (io .LimitReader (resp .Body , 64000 )) // 64KB
4445 }
45- return ErrUnexpectedStatus {Status : resp .Status , StatusCode : resp .StatusCode , Body : b }
46+ err := ErrUnexpectedStatus {
47+ Body : b ,
48+ Status : resp .Status ,
49+ StatusCode : resp .StatusCode ,
50+ RequestMethod : resp .Request .Method ,
51+ }
52+ if resp .Request .URL != nil {
53+ err .RequestURL = resp .Request .URL .String ()
54+ }
55+ return err
4656}
You can’t perform that action at this time.
0 commit comments