refactor HTTP error.

This commit is contained in:
Miroslav Šedivý 2021-09-16 20:16:51 +02:00
parent d46c5d9d30
commit 4fa11e6a2a
15 changed files with 166 additions and 102 deletions

View file

@ -28,7 +28,7 @@ func (api *ApiManagerCtx) Login(w http.ResponseWriter, r *http.Request) {
session, token, err := api.members.Login(data.Username, data.Password)
if err != nil {
utils.HttpUnauthorized(w, err)
utils.HttpUnauthorized(w).WithInternalErr(err).Send()
return
}
@ -52,7 +52,7 @@ func (api *ApiManagerCtx) Logout(w http.ResponseWriter, r *http.Request) {
err := api.members.Logout(session.ID())
if err != nil {
utils.HttpUnauthorized(w, err)
utils.HttpUnauthorized(w).WithInternalErr(err).Send()
return
}