Handle the bad request status for the CreateStorageSpace function

This commit is contained in:
Roman Perekhod
2023-06-07 13:29:06 +02:00
parent 9b075ef3f2
commit c0f06cc679
2 changed files with 12 additions and 0 deletions
+5
View File
@@ -319,6 +319,11 @@ func (g Graph) CreateDrive(w http.ResponseWriter, r *http.Request) {
errorcode.NotAllowed.Render(w, r, http.StatusForbidden, "permission denied")
return
}
if resp.GetStatus().GetCode() == cs3rpc.Code_CODE_INVALID_ARGUMENT {
logger.Debug().Str("grpcmessage", resp.GetStatus().GetMessage()).Msg("could not create drive: bad request")
errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, resp.GetStatus().GetMessage())
return
}
logger.Debug().Interface("grpcmessage", csr).Str("grpc", resp.GetStatus().GetMessage()).Msg("could not create drive: grpc error")
errorcode.GeneralException.Render(w, r, http.StatusInternalServerError, resp.GetStatus().GetMessage())
return