SMTPError type is a copy of emersion/go-smtp.SMTPError type that extends it with Fields method for logging and reporting in maddy. It should be used instead of the go-smtp library type for all errors.
| 35 | // in maddy. It should be used instead of the go-smtp library type for all |
| 36 | // errors. |
| 37 | type SMTPError struct { |
| 38 | // SMTP status code. Most of these codes are overly generic and are barely |
| 39 | // useful. Nonetheless, take a look at the 'Associated basic status code' |
| 40 | // in the SMTP Enhanced Status Codes registry (below), then check RFC 5321 |
| 41 | // (Section 4.3.2) and pick what you like. Stick to 451 and 554 if there are |
| 42 | // no useful codes. |
| 43 | Code int |
| 44 | |
| 45 | // Enhanced SMTP status code. If you are unsure, take a look at |
| 46 | // https://www.iana.org/assignments/smtp-enhanced-status-codes/smtp-enhanced-status-codes.xhtml |
| 47 | EnhancedCode EnhancedCode |
| 48 | |
| 49 | // Error message that should be returned to the SMTP client. |
| 50 | // Usually, it should be a short and generic description of the error |
| 51 | // that excludes any details. Especially, for checks, avoid |
| 52 | // mentioning the exact policy mechanism used to avoid disclosing the |
| 53 | // server configuration details. Don't say "DNS error during DMARC check", |
| 54 | // say "DNS error during policy check". Same goes for network and file I/O |
| 55 | // errors. ESPECIALLY, don't include any configuration variables or object |
| 56 | // identifiers in it. |
| 57 | Message string |
| 58 | |
| 59 | // If the error was generated by a message check |
| 60 | // this field includes module name. |
| 61 | CheckName string |
| 62 | |
| 63 | // If the error was generated by a delivery target |
| 64 | // this field includes module name. |
| 65 | TargetName string |
| 66 | |
| 67 | // If the error was generated by a message modifier |
| 68 | // this field includes module name. |
| 69 | ModifierName string |
| 70 | |
| 71 | // If the error was generated as a result of another |
| 72 | // error - this field contains the original error object. |
| 73 | // |
| 74 | // Err.Error() will be copied into the 'reason' field returned |
| 75 | // by the Fields method unless a different values is specified |
| 76 | // using the Reason field below. |
| 77 | Err error |
| 78 | |
| 79 | // Textual explanation of the actual error reason. Defaults to the |
| 80 | // Err.Error() value if Err is not nil, empty string otherwise. |
| 81 | Reason string |
| 82 | |
| 83 | Misc map[string]interface{} |
| 84 | } |
| 85 | |
| 86 | func (se *SMTPError) Unwrap() error { |
| 87 | return se.Err |
nothing calls this directly
no outgoing calls
no test coverage detected