cloudapi/v2: add details for non-service errors

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.
This commit is contained in:
Sanne Raymaekers 2024-06-25 13:06:26 +02:00
parent 39d2068d31
commit 86fd957c9d

View file

@ -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)