mirror of
https://github.com/rancher/norman.git
synced 2025-09-09 11:09:59 +00:00
status => Status
This commit is contained in:
@@ -32,11 +32,11 @@ var (
|
||||
|
||||
type ErrorCode struct {
|
||||
code string
|
||||
status int
|
||||
Status int
|
||||
}
|
||||
|
||||
func (e ErrorCode) String() string {
|
||||
return fmt.Sprintf("%s %d", e.code, e.status)
|
||||
return fmt.Sprintf("%s %d", e.code, e.Status)
|
||||
}
|
||||
|
||||
type APIError struct {
|
||||
@@ -49,7 +49,7 @@ type APIError struct {
|
||||
func NewAPIErrorLong(status int, code, message string) error {
|
||||
return NewAPIError(ErrorCode{
|
||||
code: code,
|
||||
status: status,
|
||||
Status: status,
|
||||
}, message)
|
||||
}
|
||||
|
||||
|
@@ -18,13 +18,13 @@ func ErrorHandler(request *types.APIContext, err error) {
|
||||
}
|
||||
|
||||
data := toError(error)
|
||||
request.WriteResponse(error.code.status, data)
|
||||
request.WriteResponse(error.code.Status, data)
|
||||
}
|
||||
|
||||
func toError(apiError *APIError) map[string]interface{} {
|
||||
e := map[string]interface{}{
|
||||
"type": "/meta/schemas/error",
|
||||
"status": apiError.code.status,
|
||||
"status": apiError.code.Status,
|
||||
"code": apiError.code.code,
|
||||
"message": apiError.message,
|
||||
}
|
||||
|
Reference in New Issue
Block a user