From bd655b768b9c44a62f6fc7b61d6e97ac766de86d Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Thu, 14 Nov 2024 10:20:52 +0100 Subject: [PATCH] Refactor SendError initialization for better readability Structured the initialization of SendError on connection errors to improve code readability and maintainability. This change affects the error handling in both client_120.go and client_119.go by spreading the error details across multiple lines. --- client_119.go | 6 ++++-- client_120.go | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/client_119.go b/client_119.go index 5837337..a28f747 100644 --- a/client_119.go +++ b/client_119.go @@ -32,8 +32,10 @@ func (c *Client) Send(messages ...*Msg) error { escSupport, _ = c.smtpClient.Extension("ENHANCEDSTATUSCODES") } if err := c.checkConn(); err != nil { - return &SendError{Reason: ErrConnCheck, errlist: []error{err}, isTemp: isTempError(err), - errcode: errorCode(err), enhancedStatusCode: enhancedStatusCode(err, escSupport)} + return &SendError{ + Reason: ErrConnCheck, errlist: []error{err}, isTemp: isTempError(err), + errcode: errorCode(err), enhancedStatusCode: enhancedStatusCode(err, escSupport), + } } var errs []*SendError for id, message := range messages { diff --git a/client_120.go b/client_120.go index 38eb76e..67c5b5e 100644 --- a/client_120.go +++ b/client_120.go @@ -32,8 +32,10 @@ func (c *Client) Send(messages ...*Msg) (returnErr error) { escSupport, _ = c.smtpClient.Extension("ENHANCEDSTATUSCODES") } if err := c.checkConn(); err != nil { - returnErr = &SendError{Reason: ErrConnCheck, errlist: []error{err}, isTemp: isTempError(err), - errcode: errorCode(err), enhancedStatusCode: enhancedStatusCode(err, escSupport)} + returnErr = &SendError{ + Reason: ErrConnCheck, errlist: []error{err}, isTemp: isTempError(err), + errcode: errorCode(err), enhancedStatusCode: enhancedStatusCode(err, escSupport), + } return }