new endpoint to return product list

This commit is contained in:
Daniel Goc
2026-03-18 11:39:18 +01:00
parent a0dcb56fda
commit 6cebcacb5d
23 changed files with 1243 additions and 66 deletions

View File

@@ -43,6 +43,9 @@ var (
ErrInvalidXHTML = errors.New("text is not in xhtml format")
ErrAIResponseFail = errors.New("AI responded with failure")
ErrAIBadOutput = errors.New("AI response does not obey the format")
// Typed errors for product list handler
ErrBadPaging = errors.New("bad or missing paging attribute value in header")
)
// Error represents an error with HTTP status code
@@ -123,6 +126,9 @@ func GetErrorCode(c fiber.Ctx, err error) string {
case errors.Is(err, ErrAIBadOutput):
return i18n.T_(c, "error.err_ai_bad_output")
case errors.Is(err, ErrBadPaging):
return i18n.T_(c, "error.err_bad_paging")
default:
return i18n.T_(c, "error.err_internal_server_error")
}
@@ -154,7 +160,8 @@ func GetErrorStatus(err error) int {
errors.Is(err, ErrInvalidPassword),
errors.Is(err, ErrBadAttribute),
errors.Is(err, ErrBadField),
errors.Is(err, ErrInvalidXHTML):
errors.Is(err, ErrInvalidXHTML),
errors.Is(err, ErrBadPaging):
return fiber.StatusBadRequest
case errors.Is(err, ErrEmailExists):
return fiber.StatusConflict