diff --git a/vehicle/volvo.go b/vehicle/volvo.go index e58180d96..9aa1568e8 100644 --- a/vehicle/volvo.go +++ b/vehicle/volvo.go @@ -92,6 +92,8 @@ func (v *Volvo) vehicles() ([]string, error) { vehicles = append(vehicles, vehicle.VehicleID) } + } else if res.ErrorLabel != "" { + err = fmt.Errorf("%w: %s: %s", err, res.ErrorLabel, res.ErrorDescription) } return vehicles, err @@ -102,6 +104,9 @@ func (v *Volvo) status() (volvo.Status, error) { uri := fmt.Sprintf("%s/vehicles/%s/status", volvo.ApiURI, v.vin) err := v.GetJSON(uri, &res) + if err != nil && res.ErrorLabel != "" { + err = fmt.Errorf("%w: %s: %s", err, res.ErrorLabel, res.ErrorDescription) + } return res, err } diff --git a/vehicle/volvo/types.go b/vehicle/volvo/types.go index f48f97d2f..1211585d7 100644 --- a/vehicle/volvo/types.go +++ b/vehicle/volvo/types.go @@ -8,6 +8,8 @@ import ( const ApiURI = "https://vocapi.wirelesscar.net/customerapi/rest/v3.0" type AccountResponse struct { + ErrorLabel string `json:"errorLabel"` + ErrorDescription string `json:"errorDescription"` FirstName string `json:"firstName"` LastName string `json:"lastName"` VehicleRelations []string `json:"accountVehicleRelations"` @@ -25,6 +27,8 @@ type VehicleRelation struct { } type Status struct { + ErrorLabel string `json:"errorLabel"` + ErrorDescription string `json:"errorDescription"` AverageFuelConsumption float32 `json:"averageFuelConsumption"` AverageFuelConsumptionTimestamp Timestamp `json:"averageFuelConsumptionTimestamp"` AverageSpeed int `json:"averageSpeed"`