1
0

Improved error handling

This commit is contained in:
konrad
2018-10-06 15:04:14 +02:00
parent a4137b3d6f
commit f969593c0a
14 changed files with 345 additions and 177 deletions

View File

@ -20,17 +20,7 @@ func (c *WebHandler) ReadAllWeb(ctx echo.Context) error {
lists, err := c.CObject.ReadAll(&currentUser)
if err != nil {
models.Log.Error(err.Error())
if models.IsErrNeedToHaveListReadAccess(err) {
return echo.NewHTTPError(http.StatusForbidden, "You need to have read access to this list.")
}
if models.IsErrNamespaceDoesNotExist(err) {
return echo.NewHTTPError(http.StatusNotFound, "This namespace does not exist.")
}
return echo.NewHTTPError(http.StatusInternalServerError, "An error occurred.")
return HandleHTTPError(err)
}
return ctx.JSON(http.StatusOK, lists)