code refactor

This commit is contained in:
Daniel Goc
2026-03-17 10:55:17 +01:00
parent 0da596826e
commit a0dcb56fda
8 changed files with 187 additions and 177 deletions

View File

@@ -38,7 +38,7 @@ var (
ErrVerificationTokenExpired = errors.New("verification token has expired")
// Typed errors for product description handler
ErrBadAttribute = errors.New("bad attribute")
ErrBadAttribute = errors.New("bad or missing attribute value in header")
ErrBadField = errors.New("this field can not be updated")
ErrInvalidXHTML = errors.New("text is not in xhtml format")
ErrAIResponseFail = errors.New("AI responded with failure")
@@ -119,9 +119,9 @@ func GetErrorCode(c fiber.Ctx, err error) string {
case errors.Is(err, ErrInvalidXHTML):
return i18n.T_(c, "error.err_invalid_html")
case errors.Is(err, ErrAIResponseFail):
return i18n.T_(c, "error.err_openai_response_fail")
return i18n.T_(c, "error.err_ai_response_fail")
case errors.Is(err, ErrAIBadOutput):
return i18n.T_(c, "error.err_openai_bad_output")
return i18n.T_(c, "error.err_ai_bad_output")
default:
return i18n.T_(c, "error.err_internal_server_error")