From 1fc030afe4234891aa3020fa2942eebd4854b400 Mon Sep 17 00:00:00 2001 From: Alysson Ribeiro <15274059+sonalys@users.noreply.github.com> Date: Thu, 7 Nov 2024 14:59:06 +0100 Subject: [PATCH] Feature(sendError): add unwrap interface --- senderror.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/senderror.go b/senderror.go index 4471208..9059d78 100644 --- a/senderror.go +++ b/senderror.go @@ -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 @@ -224,3 +228,5 @@ func (r SendErrReason) String() string { func isTempError(err error) bool { return err.Error()[0] == '4' } + +var _ interface{ Unwrap() []error } = &SendError{}