You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-xmpp/conn_error.go

34 lines
620 B

package xmpp
import (
"fmt"
"golang.org/x/xerrors"
)
type ConnError struct {
frame xerrors.Frame
err error
// Permanent will be true if error is not recoverable
Permanent bool
}
func NewConnError(err error, permanent bool) ConnError {
return ConnError{err: err, frame: xerrors.Caller(1), Permanent: permanent}
}
func (e ConnError) Format(s fmt.State, verb rune) {
xerrors.FormatError(e, s, verb)
}
func (e ConnError) FormatError(p xerrors.Printer) error {
e.frame.Format(p)
return e.err
}
func (e ConnError) Error() string {
return fmt.Sprint(e)
}
func (e ConnError) Unwrap() error { return e.err }