Skip to content

Commit

Permalink
fix: 馃悰 fix custom domain errors bug (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mehdi Hadeli committed Aug 25, 2023
1 parent 30564ad commit c0dea76
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ type invalidDeliveryAddressError struct {
}
type InvalidDeliveryAddressError interface {
customErrors.BadRequestError
IsInvalidDeliveryAddressError() bool
}

func NewInvalidDeliveryAddressError(message string) error {
Expand All @@ -23,14 +22,10 @@ func NewInvalidDeliveryAddressError(message string) error {
return errors.WithStackIf(br)
}

func (err *invalidDeliveryAddressError) IsInvalidDeliveryAddressError() bool {
return true
}

func IsInvalidDeliveryAddressError(err error) bool {
var ia InvalidDeliveryAddressError
if errors.As(err, &ia) {
return ia.IsInvalidDeliveryAddressError()
return true
}

return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ type invalidEmailAddressError struct {

type InvalidEmailAddressError interface {
customErrors.BadRequestError
IsInvalidEmailAddressError() bool
}

func NewInvalidEmailAddressError(message string) error {
Expand All @@ -24,14 +23,10 @@ func NewInvalidEmailAddressError(message string) error {
return errors.WithStackIf(br)
}

func (err *invalidEmailAddressError) IsInvalidEmailAddressError() bool {
return true
}

func IsInvalidEmailAddressError(err error) bool {
var ie InvalidEmailAddressError
if errors.As(err, &ie) {
return ie.IsInvalidEmailAddressError()
return true
}

return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ type orderShopItemsRequiredError struct {

type OrderShopItemsRequiredError interface {
customErrors.BadRequestError
IsOrderShopItemsRequiredError() bool
}

func NewOrderShopItemsRequiredError(message string) error {
Expand All @@ -24,14 +23,10 @@ func NewOrderShopItemsRequiredError(message string) error {
return errors.WithStackIf(br)
}

func (err *orderShopItemsRequiredError) IsOrderShopItemsRequiredError() bool {
return true
}

func IsOrderShopItemsRequiredError(err error) bool {
var os OrderShopItemsRequiredError
if errors.As(err, &os) {
return os.IsOrderShopItemsRequiredError()
return true
}

return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ type orderNotFoundError struct {

type OrderNotFoundError interface {
customErrors.NotFoundError
IsOrderNotFoundError() bool
}

func NewOrderNotFoundError(id int) error {
Expand All @@ -26,14 +25,10 @@ func NewOrderNotFoundError(id int) error {
return errors.WithStackIf(br)
}

func (err *orderNotFoundError) IsOrderNotFoundError() bool {
return true
}

func IsOrderNotFoundError(err error) bool {
var os OrderNotFoundError
if errors.As(err, &os) {
return os.IsOrderNotFoundError()
return true
}

return false
Expand Down

0 comments on commit c0dea76

Please sign in to comment.