use echo.NewHTTPError

This commit is contained in:
konrad 2018-07-11 14:27:16 +02:00 committed by kolaente
parent 4213f3b08c
commit 4734a0a6a6
Signed by untrusted user who does not match committer: konrad
GPG key ID: F40E70337AB24C9B
5 changed files with 10 additions and 10 deletions

View file

@ -10,12 +10,12 @@ import (
func (c *WebHandler) ReadAllWeb(ctx echo.Context) error {
currentUser, err := models.GetCurrentUser(ctx)
if err != nil {
return ctx.JSON(http.StatusInternalServerError, models.Message{"Could not determine the current user."})
return echo.NewHTTPError(http.StatusInternalServerError, "Could not determine the current user.")
}
lists, err := c.CObject.ReadAll(&currentUser)
if err != nil {
return ctx.JSON(http.StatusInternalServerError, models.Message{"Could not get."})
return echo.NewHTTPError(http.StatusInternalServerError, "An error occured.")
}
return ctx.JSON(http.StatusOK, lists)