Sfoglia il codice sorgente

Return errors in Bytes()

Jed Denlea 11 anni fa
parent
commit
77d7031f8d
1 ha cambiato i file con 2 aggiunte e 1 eliminazioni
  1. 2 1
      email.go

+ 2 - 1
email.go

@@ -103,6 +103,7 @@ func (e *Email) Bytes() ([]byte, error) {
 
 	// Write the envelope headers (including any custom headers)
 	if err := headerToBytes(buff, e.Headers); err != nil {
+		return nil, fmt.Errorf("Failed to render message headers: %s", err)
 	}
 	// Start the multipart/mixed part
 	fmt.Fprintf(buff, "--%s\r\n", w.Boundary())
@@ -114,7 +115,7 @@ func (e *Email) Bytes() ([]byte, error) {
 		header.Set("Content-Type", fmt.Sprintf("multipart/alternative;\r\n boundary=%s\r\n", subWriter.Boundary()))
 		// Write the header
 		if err := headerToBytes(buff, header); err != nil {
-
+			return nil, fmt.Errorf("Failed to render multipart message headers: %s", err)
 		}
 		// Create the body sections
 		if e.Text != "" {