Updating an error to apierror

This commit is contained in:
nikhiljindal
2015-07-10 13:25:43 -07:00
parent 9c47e0d20c
commit 1517b66001
5 changed files with 36 additions and 3 deletions

View File

@@ -193,6 +193,16 @@ func NewBadRequest(reason string) error {
}}
}
// NewServiceUnavailable creates an error that indicates that the requested service is unavailable.
func NewServiceUnavailable(reason string) error {
return &StatusError{api.Status{
Status: api.StatusFailure,
Code: http.StatusServiceUnavailable,
Reason: api.StatusReasonServiceUnavailable,
Message: reason,
}}
}
// NewMethodNotSupported returns an error indicating the requested action is not supported on this kind.
func NewMethodNotSupported(kind, action string) error {
return &StatusError{api.Status{