Files
2026-05-06 10:14:55 +03:00

28 lines
1.1 KiB
Go

package mail
import "errors"
// Sentinel errors emitted by Service methods. Handlers translate them
// into HTTP responses; tests match on them with errors.Is.
var (
// ErrDeliveryNotFound is returned by AdminGetDelivery and AdminResend
// when the supplied delivery_id does not name a row.
ErrDeliveryNotFound = errors.New("mail: delivery not found")
// ErrResendOnSent is returned by AdminResend when the targeted row
// is in the terminal `sent` state. The admin contract maps this to
// 409 Conflict; resending an already-delivered mail would push a
// duplicate copy to the recipient.
ErrResendOnSent = errors.New("mail: cannot resend a sent delivery")
// ErrUnknownTemplate is returned by EnqueueTemplate when the
// supplied template_id is not registered in the inline template
// catalog. A typo at the producer is the typical cause.
ErrUnknownTemplate = errors.New("mail: unknown template")
// ErrInvalidRecipient is returned by EnqueueLoginCode and
// EnqueueTemplate when the supplied recipient address is empty or
// fails go-mail's RFC 5322 validation.
ErrInvalidRecipient = errors.New("mail: invalid recipient address")
)