forked from TrueCloudLab/frostfs-s3-gw
[#155] Fix error handling
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
1ecf32c302
commit
f2eeed0b85
3 changed files with 3 additions and 15 deletions
|
@ -2,7 +2,6 @@ package handler
|
|||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
@ -120,18 +119,7 @@ func (h *handler) listObjects(w http.ResponseWriter, r *http.Request) (*listObje
|
|||
zap.String("request_id", rid),
|
||||
zap.Error(err))
|
||||
|
||||
var s3Err api.Error
|
||||
if ok := errors.As(err, &s3Err); ok {
|
||||
api.WriteErrorResponse(r.Context(), w, s3Err, r.URL)
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
api.WriteErrorResponse(r.Context(), w, api.Error{
|
||||
Code: api.GetAPIError(api.ErrBadRequest).Code,
|
||||
Description: err.Error(),
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
}, r.URL)
|
||||
|
||||
api.WriteErrorResponse(r.Context(), w, err, r.URL)
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue