added new endpoint to save product descriptions
This commit is contained in:
@@ -39,6 +39,8 @@ var (
|
||||
|
||||
// Typed errors for product description handler
|
||||
ErrBadAttribute = errors.New("bad attribute")
|
||||
ErrBadField = errors.New("this field can not be updated")
|
||||
ErrInvalidHTML = errors.New("text is not in html format")
|
||||
)
|
||||
|
||||
// Error represents an error with HTTP status code
|
||||
@@ -110,6 +112,10 @@ func GetErrorCode(c fiber.Ctx, err error) string {
|
||||
|
||||
case errors.Is(err, ErrBadAttribute):
|
||||
return i18n.T_(c, "error.err_bad_attribute")
|
||||
case errors.Is(err, ErrBadField):
|
||||
return i18n.T_(c, "error.err_bad_field")
|
||||
case errors.Is(err, ErrInvalidHTML):
|
||||
return i18n.T_(c, "error.err_invalid_html")
|
||||
|
||||
default:
|
||||
return i18n.T_(c, "error.err_internal_server_error")
|
||||
@@ -140,7 +146,9 @@ func GetErrorStatus(err error) int {
|
||||
errors.Is(err, ErrInvalidVerificationToken),
|
||||
errors.Is(err, ErrVerificationTokenExpired),
|
||||
errors.Is(err, ErrInvalidPassword),
|
||||
errors.Is(err, ErrBadAttribute):
|
||||
errors.Is(err, ErrBadAttribute),
|
||||
errors.Is(err, ErrBadField),
|
||||
errors.Is(err, ErrInvalidHTML):
|
||||
return fiber.StatusBadRequest
|
||||
case errors.Is(err, ErrEmailExists):
|
||||
return fiber.StatusConflict
|
||||
|
||||
Reference in New Issue
Block a user