linstrom/auth-new/errors.go
2025-03-31 23:23:25 +02:00

27 lines
886 B
Go

package auth
import "errors"
var (
// The provided authentication method is not known to the server
ErrUnknownAuthMethod = errors.New("unknown authentication method")
// The user hasn't setup the provided authentication method
ErrUnsupportedAuthMethod = errors.New("authentication method not supported for this user")
ErrInvalidCombination = errors.New("invalid account and token combination")
ErrProcessTimeout = errors.New("authentication process timed out")
// A user may not login, for whatever reason
ErrCantLogin = errors.New("user can't login")
ErrDecryptionFailure = errors.New("failed to decrypt content")
)
type CombinedError struct {
Err1, Err2 error
}
func (c *CombinedError) Is(e error) bool {
return errors.Is(e, c.Err1) || errors.Is(e, c.Err2)
}
func (c *CombinedError) Error() string {
return c.Err1.Error() + " + " + c.Err2.Error()
}