smtpd/error.go

22 lines
519 B
Go

package smtpd
import (
"errors"
"fmt"
)
// Error represents an Error reported in the SMTP session.
type Error struct {
Code int // The integer error code
Message string // The error message
}
// Error returns a string representation of the SMTP error
func (e Error) Error() string {
return fmt.Sprintf("%d %s", e.Code, e.Message)
}
// ErrServerClosed is returned by the Server's Serve and ListenAndServe,
// methods after a call to Shutdown.
var ErrServerClosed = errors.New("smtp: Server closed")