Skip to content

Commit

Permalink
Fiat: ignore HTTP 403 during deep refresh (#13428)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig authored Apr 14, 2024
1 parent 3740a31 commit ab412b4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions vehicle/fiat/provider.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package fiat

import (
"errors"
"fmt"
"net/http"
"time"

"github.com/evcc-io/evcc/api"
"github.com/evcc-io/evcc/provider"
"github.com/evcc-io/evcc/util/request"
)

const refreshTimeout = 2 * time.Minute
Expand Down Expand Up @@ -48,6 +51,11 @@ func (v *Provider) deepRefresh() error {
res, err := v.action("ev", "DEEPREFRESH")
if err == nil && res.ResponseStatus != "pending" {
err = fmt.Errorf("invalid response status: %s", res.ResponseStatus)
} else {
var se request.StatusError
if errors.As(err, &se) && se.StatusCode() == http.StatusForbidden {
err = nil
}
}
return err
}
Expand Down

0 comments on commit ab412b4

Please sign in to comment.