Skip to content

Commit

Permalink
Feature(sendError): add unwrap interface
Browse files Browse the repository at this point in the history
  • Loading branch information
sonalys committed Nov 7, 2024
1 parent b4aa414 commit 1fc030a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions senderror.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ func (e *SendError) Is(errType error) bool {
return false
}

func (e *SendError) Unwrap() []error {
return e.errlist
}

// IsTemp returns true if the delivery error is of a temporary nature and can be retried.
//
// This function checks whether the SendError indicates a temporary error, which suggests
Expand Down Expand Up @@ -224,3 +228,5 @@ func (r SendErrReason) String() string {
func isTempError(err error) bool {
return err.Error()[0] == '4'
}

var _ interface{ Unwrap() []error } = &SendError{}

0 comments on commit 1fc030a

Please sign in to comment.