Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Fix mailer error bug #4042
Fix mailer error bug #4042
Conversation
|
Thanks for working on this! Can you update the PR description to say what the problem was and how you're fixing it? |
| // return from SendMail() with the error | ||
| m.stats.Inc("SendMail.Errors", 1) | ||
| return err | ||
| if protoErr, ok := err.(*textproto.Error); ok { |
jsha
Feb 7, 2019
Contributor
I think you can hoist this type-check to where we currently have if err != nil. So we'd have:
if err == nil {
} else if err == io.EOF {
} else if protoErr, ok := err.(*textproto.Error); ok && protoErr == 421 {
} else if protoErr, ok := err.(*textproto.Error); ok && recoverableErrorCodes[protoErr.Code] {
} else {
... return err ...
}
Also note this just uses the bool value in recoverableErrorCodes instead of using the , ok method since it's a map of bools.
I think you can hoist this type-check to where we currently have if err != nil. So we'd have:
if err == nil {
} else if err == io.EOF {
} else if protoErr, ok := err.(*textproto.Error); ok && protoErr == 421 {
} else if protoErr, ok := err.(*textproto.Error); ok && recoverableErrorCodes[protoErr.Code] {
} else {
... return err ...
}
Also note this just uses the bool value in recoverableErrorCodes instead of using the , ok method since it's a map of bools.
|
Oh also Travis is failing. :-) |
|
Nice work! |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

This fixes two bugs:
resetAndErrorwould be called on every error, includingio.EOF, which is returned when the connection is terminated. Callingm.client.Reset()after aio.EOFwill result in another error, causing us to wrap theio.EOFwith aerrors.errorString. This broke a check insendMailthat was used to cause a reconnect.