@@ -34,10 +34,10 @@ import (
34
34
)
35
35
36
36
var (
37
- ValidationNoFromAddressErr = xerrors .New ("'from' address not defined" )
38
- ValidationNoToAddressErr = xerrors .New ("'to' address(es) not defined" )
39
- ValidationNoSmarthostErr = xerrors .New ("'smarthost' address not defined" )
40
- ValidationNoHelloErr = xerrors .New ("'hello' not defined" )
37
+ ErrValidationNoFromAddress = xerrors .New ("'from' address not defined" )
38
+ ErrValidationNoToAddress = xerrors .New ("'to' address(es) not defined" )
39
+ ErrValidationNoSmarthost = xerrors .New ("'smarthost' address not defined" )
40
+ ErrValidationNoHello = xerrors .New ("'hello' not defined" )
41
41
42
42
//go:embed smtp/html.gotmpl
43
43
htmlTemplate string
@@ -493,7 +493,7 @@ func (*SMTPHandler) validateFromAddr(from string) (string, error) {
493
493
return "" , xerrors .Errorf ("parse 'from' address: %w" , err )
494
494
}
495
495
if len (addrs ) != 1 {
496
- return "" , ValidationNoFromAddressErr
496
+ return "" , ErrValidationNoFromAddress
497
497
}
498
498
return from , nil
499
499
}
@@ -505,7 +505,7 @@ func (s *SMTPHandler) validateToAddrs(to string) ([]string, error) {
505
505
}
506
506
if len (addrs ) == 0 {
507
507
s .log .Warn (context .Background (), "no valid 'to' address(es) defined; some may be invalid" , slog .F ("defined" , to ))
508
- return nil , ValidationNoToAddressErr
508
+ return nil , ErrValidationNoToAddress
509
509
}
510
510
511
511
var out []string
@@ -522,7 +522,7 @@ func (s *SMTPHandler) validateToAddrs(to string) ([]string, error) {
522
522
func (s * SMTPHandler ) smarthost () (string , string , error ) {
523
523
smarthost := strings .TrimSpace (string (s .cfg .Smarthost ))
524
524
if smarthost == "" {
525
- return "" , "" , ValidationNoSmarthostErr
525
+ return "" , "" , ErrValidationNoSmarthost
526
526
}
527
527
528
528
host , port , err := net .SplitHostPort (string (s .cfg .Smarthost ))
@@ -538,7 +538,7 @@ func (s *SMTPHandler) smarthost() (string, string, error) {
538
538
func (s * SMTPHandler ) hello () (string , error ) {
539
539
val := s .cfg .Hello .String ()
540
540
if val == "" {
541
- return "" , ValidationNoHelloErr
541
+ return "" , ErrValidationNoHello
542
542
}
543
543
return val , nil
544
544
}
0 commit comments