mirror of
https://github.com/minio/minio.git
synced 2025-11-20 01:50:24 -05:00
Add crypto context errors (#8740)
Currently when connections to vault fail, client perpetually retries this leads to assumptions that the server has issues and masks the problem. Re-purpose *crypto.Error* type to send appropriate errors back to the client.
This commit is contained in:
committed by
kannappanr
parent
796cca4166
commit
933c60bc3a
@@ -2026,13 +2026,20 @@ func toJSONError(ctx context.Context, err error, params ...string) (jerr *json2.
|
||||
// toWebAPIError - convert into error into APIError.
|
||||
func toWebAPIError(ctx context.Context, err error) APIError {
|
||||
switch err {
|
||||
case errNoAuthToken:
|
||||
return APIError{
|
||||
Code: "WebTokenMissing",
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
Description: err.Error(),
|
||||
}
|
||||
case errServerNotInitialized:
|
||||
return APIError{
|
||||
Code: "XMinioServerNotInitialized",
|
||||
HTTPStatusCode: http.StatusServiceUnavailable,
|
||||
Description: err.Error(),
|
||||
}
|
||||
case errAuthentication, auth.ErrInvalidAccessKeyLength, auth.ErrInvalidSecretKeyLength, errInvalidAccessKeyID:
|
||||
case errAuthentication, auth.ErrInvalidAccessKeyLength,
|
||||
auth.ErrInvalidSecretKeyLength, errInvalidAccessKeyID:
|
||||
return APIError{
|
||||
Code: "AccessDenied",
|
||||
HTTPStatusCode: http.StatusForbidden,
|
||||
|
||||
Reference in New Issue
Block a user