v1.0.0
This commit is contained in:
commit
1329892e96
292 files changed
+43992
No files matched your search
@@ -0,0 +1,37 @@
|
||||
// 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
|
||||
}
|
||||
if len(e.Body) == 0 {
|
||||
return status
|
||||
}
|
||||
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)
|
||||
}
|
||||
Reference in new issue
Block a user