always use error interface when returning errors (#8816)

* always use error interface when returning errors

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* fix: use non pointer Error

* fix: errorcode evaluation

---------

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Co-authored-by: Florian Schade <f.schade@icloud.com>
This commit is contained in:
Jörn Friedrich Dreyer
2024-04-12 10:30:49 +02:00
committed by GitHub
parent fad37db840
commit 7a635738fa
13 changed files with 142 additions and 90 deletions

View File

@@ -166,7 +166,8 @@ func RenderError(w http.ResponseWriter, r *http.Request, err error) {
var errcode Error
if errors.As(err, &errcode) {
errcode.Render(w, r)
} else {
GeneralException.Render(w, r, http.StatusInternalServerError, err.Error())
return
}
GeneralException.Render(w, r, http.StatusInternalServerError, err.Error())
}