...
1 package http
2
3 import (
4 "fmt"
5 "net/http"
6 )
7
8
9
10 type Response struct {
11 *http.Response
12 }
13
14
15
16 type ResponseError struct {
17 Response *Response
18 Err error
19 }
20
21
22 func (e *ResponseError) HTTPStatusCode() int { return e.Response.StatusCode }
23
24
25 func (e *ResponseError) HTTPResponse() *Response { return e.Response }
26
27
28 func (e *ResponseError) Unwrap() error { return e.Err }
29
30 func (e *ResponseError) Error() string {
31 return fmt.Sprintf(
32 "http response error StatusCode: %d, %v",
33 e.Response.StatusCode, e.Err)
34 }
35
View as plain text