move errors to new package to break import cycle

This commit is contained in:
Cubicroot 2021-06-20 17:39:10 +02:00
parent 5f5d941bc4
commit dafc815be5
8 changed files with 195 additions and 20 deletions

View file

@ -5,6 +5,7 @@ import (
"net/http"
"github.com/pushbits/server/internal/authentication"
"github.com/pushbits/server/internal/pberrors"
"github.com/gin-gonic/gin"
)
@ -13,7 +14,7 @@ func successOrAbort(ctx *gin.Context, code int, err error) bool {
if err != nil {
// If we know the error force error code
switch err {
case ErrorMessageNotFound:
case pberrors.ErrorMessageNotFound:
ctx.AbortWithError(http.StatusNotFound, err)
default:
ctx.AbortWithError(code, err)