Porsche: extract emobility errors

This commit is contained in:
andig 2021-10-20 15:26:28 +02:00
parent 43c40f01be
commit 4ce8e5a72e

View file

@ -1,6 +1,7 @@
package porsche
import (
"errors"
"fmt"
"net/http"
"time"
@ -64,6 +65,7 @@ type EmobilityResponse struct {
ClimatisationState string
RemainingClimatisationTime int64
}
PcckErrorMessage string
}
// EMobilityProvider is an api.Vehicle implementation for Porsche Taycan cars
@ -137,6 +139,10 @@ func (v *EMobilityProvider) status(vin string) (interface{}, error) {
var pr EmobilityResponse
err = v.DoJSON(req, &pr)
if err != nil && pr.PcckErrorMessage != "" {
err = errors.New(pr.PcckErrorMessage)
}
return pr, err
}