2026-08-26 17:05:17 +03:00
|
|
|
// Code generated by internal codegen utility; DO NOT EDIT.
|
|
|
|
|
|
|
|
|
|
package core
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"net/http"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// HTTPError is returned for a non-2xx HTTP response.
|
|
|
|
|
type HTTPError struct {
|
|
|
|
|
StatusCode int
|
|
|
|
|
Header http.Header
|
|
|
|
|
Body []byte
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (e *HTTPError) Error() string {
|
|
|
|
|
status := fmt.Sprintf("HTTP %d", e.StatusCode)
|
|
|
|
|
if statusText := http.StatusText(e.StatusCode); statusText != "" {
|
|
|
|
|
status += " " + statusText
|
|
|
|
|
}
|
2026-09-28 11:14:36 +03:00
|
|
|
|
2026-08-26 17:05:17 +03:00
|
|
|
if len(e.Body) == 0 {
|
|
|
|
|
return status
|
|
|
|
|
}
|
2026-09-28 11:14:36 +03:00
|
|
|
|
2026-08-26 17:05:17 +03:00
|
|
|
return status + ": " + string(e.Body)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// BackendError is returned when the backend reports an error in an otherwise
|
|
|
|
|
// successful HTTP response.
|
|
|
|
|
type BackendError struct {
|
|
|
|
|
Code int64
|
|
|
|
|
Message string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (e *BackendError) Error() string {
|
|
|
|
|
return fmt.Sprintf("code: %v, message: %v", e.Code, e.Message)
|
|
|
|
|
}
|