Config UI: add provider auth subject to login errors (#25342)

This commit is contained in:
andig 2025-11-20 19:02:18 +01:00 • committed by GitHub
parent 5aadb01eae
commit 1f0bd92518
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 58 additions and 32 deletions

View file

@ -18,9 +18,6 @@ var ErrSponsorRequired = errors.New("sponsorship required, see https://docs.evcc
// ErrMissingCredentials indicates that user/password are missing
var ErrMissingCredentials = backoff.Permanent(errors.New("missing user/password credentials"))
// ErrLoginRequired indicates that retrieving tokens credentials waits for login
var ErrLoginRequired = backoff.Permanent(errors.New("login required"))
// ErrMissingToken indicates that access/refresh tokens are missing
var ErrMissingToken = backoff.Permanent(errors.New("missing token credentials"))
@ -30,6 +27,22 @@ var ErrOutdated = errors.New("outdated")
// ErrTimeout is the error returned when a timeout happened
var ErrTimeout error = errors.New("timeout")
// LoginRequiredError creates a login error for given auth provider
func LoginRequiredError(providerAuth string) error {
return backoff.Permanent(&ErrLoginRequired{
ProviderAuth: providerAuth,
})
}
// ErrLoginRequired indicates that retrieving tokens credentials waits for login
type ErrLoginRequired struct {
ProviderAuth string
}
func (err *ErrLoginRequired) Error() string {
return "login required"
}
// ErrAsleep indicates that vehicle is asleep. Caller may chose to wake up the vehicle and retry.
var ErrAsleep error = errAsleep{}