obj: Object api handle all errors in common location. (#1343)

This commit is contained in:
Harshavardhana
2016-04-20 17:23:23 -07:00
committed by Harshavardhana
parent 5c33b68318
commit 91588209fa
7 changed files with 113 additions and 133 deletions

View File

@@ -105,6 +105,10 @@ const (
ErrInvalidQuerySignatureAlgo
ErrInvalidQueryParams
// Add new error codes here.
// Extended errors.
ErrInsufficientReadResources
ErrInsufficientWriteResources
)
// error code to APIError structure, these fields carry respective
@@ -185,6 +189,16 @@ var errorCodeResponse = map[APIErrorCode]APIError{
Description: "We encountered an internal error, please try again.",
HTTPStatusCode: http.StatusInternalServerError,
},
ErrInsufficientReadResources: {
Code: "InternalError",
Description: "We cannot satisfy sufficient read resources requested at this moment, please try again.",
HTTPStatusCode: http.StatusInternalServerError,
},
ErrInsufficientWriteResources: {
Code: "InternalError",
Description: "We cannot satisfy sufficient write resources requested at this moment, please try again.",
HTTPStatusCode: http.StatusInternalServerError,
},
ErrInvalidAccessKeyID: {
Code: "InvalidAccessKeyID",
Description: "The access key ID you provided does not exist in our records.",