Skip to content

Commit

Permalink
cloudapi/v2: add details for non-service errors
Browse files Browse the repository at this point in the history
In case Echo throws an error, or in case even echo doesn't manage to
catch an underlying error and wrap it, return as many details as
possible.
  • Loading branch information
croissanne committed Jun 25, 2024
1 parent 39d2068 commit 86fd957
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/cloudapi/v2/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,14 @@ func HTTPErrorHandler(echoError error, c echo.Context) {
he, ok := echoError.(*echo.HTTPError)
if !ok {
c.Logger().Errorf("ErrorNotHTTPError %v", echoError)
doResponse(nil, ErrorNotHTTPError, c, echoError)
doResponse(echoError.Error(), ErrorNotHTTPError, c, echoError)
return
}

err, ok := he.Message.(detailsError)
if !ok {
// No service code was set, so Echo threw this error
doResponse(nil, apiErrorFromEchoError(he), c, he.Internal)
doResponse(he.Error(), apiErrorFromEchoError(he), c, he.Internal)
return
}
doResponse(err.details, err.errorCode, c, he.Internal)
Expand Down

0 comments on commit 86fd957

Please sign in to comment.