fix: backend not reachable should be more descriptive (#13634)

This commit is contained in:
Harshavardhana
2021-11-10 22:33:17 -08:00
committed by GitHub
parent 5acc8c0134
commit 68c5ad83fb
4 changed files with 24 additions and 5 deletions

View File

@@ -1362,8 +1362,8 @@ var errorCodes = errorCodeMap{
},
ErrBackendDown: {
Code: "XMinioBackendDown",
Description: "Object storage backend is unreachable",
HTTPStatusCode: http.StatusServiceUnavailable,
Description: "Remote backend is unreachable",
HTTPStatusCode: http.StatusBadRequest,
},
ErrIncorrectContinuationToken: {
Code: "InvalidArgument",
@@ -2129,6 +2129,11 @@ func toAPIError(ctx context.Context, err error) APIError {
}
}
if apiErr.Code == "XMinioBackendDown" {
apiErr.Description = fmt.Sprintf("%s (%v)", apiErr.Description, err)
return apiErr
}
if apiErr.Code == "InternalError" {
// If we see an internal error try to interpret
// any underlying errors if possible depending on