mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-23 06:10:48 +01:00
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.
This commit is contained in:
parent
c8d7cf86e1
commit
bd655b768b
2 changed files with 8 additions and 4 deletions
|
@ -32,8 +32,10 @@ func (c *Client) Send(messages ...*Msg) error {
|
||||||
escSupport, _ = c.smtpClient.Extension("ENHANCEDSTATUSCODES")
|
escSupport, _ = c.smtpClient.Extension("ENHANCEDSTATUSCODES")
|
||||||
}
|
}
|
||||||
if err := c.checkConn(); err != nil {
|
if err := c.checkConn(); err != nil {
|
||||||
return &SendError{Reason: ErrConnCheck, errlist: []error{err}, isTemp: isTempError(err),
|
return &SendError{
|
||||||
errcode: errorCode(err), enhancedStatusCode: enhancedStatusCode(err, escSupport)}
|
Reason: ErrConnCheck, errlist: []error{err}, isTemp: isTempError(err),
|
||||||
|
errcode: errorCode(err), enhancedStatusCode: enhancedStatusCode(err, escSupport),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var errs []*SendError
|
var errs []*SendError
|
||||||
for id, message := range messages {
|
for id, message := range messages {
|
||||||
|
|
|
@ -32,8 +32,10 @@ func (c *Client) Send(messages ...*Msg) (returnErr error) {
|
||||||
escSupport, _ = c.smtpClient.Extension("ENHANCEDSTATUSCODES")
|
escSupport, _ = c.smtpClient.Extension("ENHANCEDSTATUSCODES")
|
||||||
}
|
}
|
||||||
if err := c.checkConn(); err != nil {
|
if err := c.checkConn(); err != nil {
|
||||||
returnErr = &SendError{Reason: ErrConnCheck, errlist: []error{err}, isTemp: isTempError(err),
|
returnErr = &SendError{
|
||||||
errcode: errorCode(err), enhancedStatusCode: enhancedStatusCode(err, escSupport)}
|
Reason: ErrConnCheck, errlist: []error{err}, isTemp: isTempError(err),
|
||||||
|
errcode: errorCode(err), enhancedStatusCode: enhancedStatusCode(err, escSupport),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue