21 lines
470 B
Go
21 lines
470 B
Go
package httpcli
|
|
|
|
import (
|
|
"fmt"
|
|
"net/url"
|
|
)
|
|
|
|
// ErrorResponse represents an HTTP error response with status code and body.
|
|
//
|
|
// nolint:errname
|
|
type ErrorResponse struct {
|
|
Url *url.URL
|
|
StatusCode int
|
|
Body []byte
|
|
}
|
|
|
|
// Error returns a formatted error message containing the URL, status code, and body.
|
|
func (e ErrorResponse) Error() string {
|
|
return fmt.Sprintf("http call error: url=%s status_code=%d, body=%s", e.Url.String(), e.StatusCode, e.Body)
|
|
}
|