Something went wrong. Try again.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233package ungh
import ( "fmt" "net/http")
type AcceptedError struct{}
func (e *AcceptedError) Error() string { return fmt.Sprintf("%d %s", http.StatusAccepted, http.StatusText(http.StatusAccepted))}
type ErrorResponse struct { Response *http.Response `json:"-"` Message string `json:"message"`}
func (e *ErrorResponse) Error() string { s := e.Message if e.Response != nil { status := e.Response.Status if status == "" { status = http.StatusText(e.Response.StatusCode) } s = fmt.Sprintf("%d %s: %s", e.Response.StatusCode, status, s) } if e.Response.Request != nil { s = fmt.Sprintf("%s %s: %s", e.Response.Request.Method, e.Response.Request.URL, s) } return s}