1
0

implemented get one namespace via interface mthod

This commit is contained in:
konrad
2018-07-12 11:54:55 +02:00
committed by kolaente
parent 6f5cf55e42
commit 868b93dbbc
3 changed files with 28 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import (
"git.kolaente.de/konrad/list/models"
"github.com/labstack/echo"
"net/http"
"fmt"
)
// ReadOneWeb is the webhandler to get one object
@ -16,6 +17,7 @@ func (c *WebHandler) ReadOneWeb(ctx echo.Context) error {
}
// TODO check rights
//c.CObject.CanRead(doer)
// Get our object
err = c.CObject.ReadOne(id)
@ -24,6 +26,12 @@ func (c *WebHandler) ReadOneWeb(ctx echo.Context) error {
return echo.NewHTTPError(http.StatusNotFound)
}
if models.IsErrNamespaceDoesNotExist(err) {
return echo.NewHTTPError(http.StatusNotFound)
}
fmt.Println(err)
return echo.NewHTTPError(http.StatusInternalServerError, "An error occured.")
}