chore(errors): always add internal error to echo error

This commit is contained in:
kolaente
2024-08-29 15:39:34 +02:00
parent bea131cfd9
commit 7a7e97770c
14 changed files with 45 additions and 50 deletions

View File

@@ -50,9 +50,9 @@ func UpdateUserEmail(c echo.Context) (err error) {
log.Debugf("Invalid model error. Internal error was: %s", err.Error())
var he *echo.HTTPError
if errors.As(err, &he) {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid model provided. Error was: %s", he.Message))
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid model provided. Error was: %s", he.Message)).SetInternal(err)
}
return echo.NewHTTPError(http.StatusBadRequest, "Invalid model provided.")
return echo.NewHTTPError(http.StatusBadRequest, "Invalid model provided.").SetInternal(err)
}
emailUpdate.User, err = user.GetCurrentUser(c)