Porsche: extract emobility errors
This commit is contained in:
parent
43c40f01be
commit
4ce8e5a72e
1 changed files with 6 additions and 0 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue