mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 12:24:38 +03:00
for imap/smtp syntax errors, only echo the remaining buffer if the connection is authenticated
This commit is contained in:
@ -8,23 +8,26 @@ import (
|
||||
|
||||
func xcheckf(err error, format string, args ...any) {
|
||||
if err != nil {
|
||||
panic(smtpError{smtp.C451LocalErr, smtp.SeSys3Other0, fmt.Errorf("%s: %w", fmt.Sprintf(format, args...), err), true, false})
|
||||
err := fmt.Errorf("%s: %w", fmt.Sprintf(format, args...), err)
|
||||
panic(smtpError{smtp.C451LocalErr, smtp.SeSys3Other0, err.Error(), err, true, false})
|
||||
}
|
||||
}
|
||||
|
||||
type smtpError struct {
|
||||
code int
|
||||
secode string
|
||||
err error
|
||||
errmsg string // Sent in response.
|
||||
err error // If set, used in logging. Typically has same information as errmsg.
|
||||
printStack bool
|
||||
userError bool // If this is an error on the user side, which causes logging at a lower level.
|
||||
}
|
||||
|
||||
func (e smtpError) Error() string { return e.err.Error() }
|
||||
func (e smtpError) Error() string { return e.errmsg }
|
||||
func (e smtpError) Unwrap() error { return e.err }
|
||||
|
||||
func xsmtpErrorf(code int, secode string, userError bool, format string, args ...any) {
|
||||
panic(smtpError{code, secode, fmt.Errorf(format, args...), false, userError})
|
||||
err := fmt.Errorf(format, args...)
|
||||
panic(smtpError{code, secode, err.Error(), err, false, userError})
|
||||
}
|
||||
|
||||
func xsmtpServerErrorf(codes codes, format string, args ...any) {
|
||||
|
Reference in New Issue
Block a user