Beta version
All checks were successful
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Successful in 24s

This commit is contained in:
2025-06-04 12:48:53 -04:00
parent e25b6a67f3
commit 934f1259d0
4 changed files with 31 additions and 30 deletions

View File

@ -121,31 +121,10 @@ func (c *Client) SelectVehicle(vin string) VehicleData {
c.logger.Error("error while parsing json", "request", "SelectVehicle", "error", err.Error())
}
// c.logger.Debug("http request output", "request", "SelectVehicle", "body", resp)
return vd
} else {
return VehicleData{}
}
// ERRORS
// """Select active vehicle for accounts with multiple VINs."""
// params = {"vin": vin, "_": int(time.time())}
// js_resp = await self.get(API_SELECT_VEHICLE, params=params)
// _LOGGER.debug(pprint.pformat(js_resp))
// if js_resp.get("success"):
// self._current_vin = vin
// _LOGGER.debug("Current vehicle: vin=%s", js_resp["data"]["vin"])
// return js_resp["data"]
// if not js_resp.get("success") and js_resp.get("errorCode") == "VEHICLESETUPERROR":
// # Occasionally happens every few hours. Resetting the session seems to deal with it.
// _LOGGER.warning("VEHICLESETUPERROR received. Resetting session.")
// self.reset_session()
// return False
// _LOGGER.debug("Failed to switch vehicle errorCode=%s", js_resp.get("errorCode"))
// # Something else is probably wrong with the backend server context - try resetting
// self.reset_session()
// raise SubaruException("Failed to switch vehicle %s - resetting session." % js_resp.get("errorCode"))
}
// GetVehicles .
@ -296,14 +275,15 @@ func (c *Client) execute(requestUrl string, method string, params map[string]str
}
} else {
if r.DataName == "errorResponse" {
// {"success":false,"errorCode":"404-soa-unableToParseResponseBody","dataName":"errorResponse","data":{"errorLabel":"404-soa-unableToParseResponseBody","errorDescription":null}}
// {"success":false,"errorCode":"vehicleNotInAccount","dataName":null,"data":null}
var er ErrorResponse
err := json.Unmarshal(r.Data, &er)
if err != nil {
c.logger.Error("error while parsing json", "request", "errorResponse", "error", err.Error())
}
c.logger.Error("request is not successfull", "request", "execute", "method", method, "url", requestUrl, "error", err.Error())
if _, ok := API_ERRORS[er.ErrorLabel]; ok {
c.logger.Error("request got an error", "request", "execute", "method", method, "url", requestUrl, "label", er.ErrorLabel, "descrip[tion", er.ErrorDescription)
}
c.logger.Error("request got an unknown error", "request", "execute", "method", method, "url", requestUrl, "label", er.ErrorLabel, "descrip[tion", er.ErrorDescription)
}
c.logger.Error("request is not successfull", "request", "execute", "method", method, "url", requestUrl, "error", err.Error())
}