Skip to content
This repository has been archived by the owner on Nov 28, 2024. It is now read-only.

Expose wrapped errors returned by Send() #12

Closed
ivy opened this issue Dec 7, 2017 · 5 comments
Closed

Expose wrapped errors returned by Send() #12

ivy opened this issue Dec 7, 2017 · 5 comments

Comments

@ivy
Copy link

ivy commented Dec 7, 2017

Originally reported in go-gomail#102, the error details are lost in Send() due the use of fmt.Errorf. As mentioned in the original issue, we should allow smarter handling of errors by exposing the original error and index in a struct:

// A SendError represents the failed transmission of a Message and details the
// original error and index of the Message if it was part of a batch.
type SendError struct {
  // Index specifies the index of the Message, if it was part of a batch.
  Index uint

  // Cause specifies the error detailing the original cause of the failure.
  Cause error
}

func (err *SendError) Error() string {
	return fmt.Sprintf("gomail: could not send email %d: %v",
		err.Index, err.Cause)
}
@ivy ivy changed the title Fix error wrapping in Send() function Expose wrapped errors returned by Send() Dec 7, 2017
@lucianjon
Copy link

I could possibly pick this up, I've wanted to improve the error handling for a while. For example if gomail rejects the address syntax it would be nicer to have a specific error that could be matched on rather than relying on a string match.

@ivy
Copy link
Author

ivy commented Dec 7, 2017

@lucianjon Yes! That would be wonderful.

@pedromorgan
Copy link

Snag here is whether to KEEP alive, or cancel.

If missued then this is the same poblem on mail server connect..
eg latentcy of 400ms for conne

This means the write out to nginx is much faster though

@sfllaw
Copy link

sfllaw commented Mar 16, 2018

@ivy Ping? Can you please leave feedback on @beeceej's pull request?

@ivy ivy closed this as completed in 770b425 Mar 16, 2018
@ivy
Copy link
Author

ivy commented Mar 16, 2018

@sfllaw Thanks for the reminder! I had some time today to integrate #19. Let me know if there anything else I can help you with.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants