added new category error, and some fixes

This commit is contained in:
Daniel Goc
2026-03-31 10:52:36 +02:00
parent ec5ff123ac
commit 8665c566ee
9 changed files with 134 additions and 24 deletions

View File

@@ -50,7 +50,8 @@ var (
ErrBadPaging = errors.New("bad or missing paging attribute value in header")
// Typed errors for menu handler
ErrNoRootFound = errors.New("no root found in categories table")
ErrNoRootFound = errors.New("no root found in categories table")
ErrCircularDependency = errors.New("circular dependency structure in tree (could be caused by improper root id)")
// Typed errors for carts handler
ErrMaxAmtOfCartsReached = errors.New("maximal amount of carts reached")
@@ -145,6 +146,8 @@ func GetErrorCode(c fiber.Ctx, err error) string {
case errors.Is(err, ErrNoRootFound):
return i18n.T_(c, "error.no_root_found")
case errors.Is(err, ErrCircularDependency):
return i18n.T_(c, "error.circular_dependency")
case errors.Is(err, ErrMaxAmtOfCartsReached):
return i18n.T_(c, "error.max_amt_of_carts_reached")
@@ -189,6 +192,7 @@ func GetErrorStatus(err error) int {
errors.Is(err, ErrInvalidXHTML),
errors.Is(err, ErrBadPaging),
errors.Is(err, ErrNoRootFound),
errors.Is(err, ErrCircularDependency),
errors.Is(err, ErrMaxAmtOfCartsReached),
errors.Is(err, ErrUserHasNoSuchCart),
errors.Is(err, ErrProductOrItsVariationDoesNotExist):