Skip to content

Commit

Permalink
fix #29 try-catch on update data
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuen Lee committed Dec 24, 2023
1 parent c56a0f0 commit 846d975
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion custom_components/polestar_api/polestar.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from datetime import timedelta
import logging

from .pypolestar.exception import PolestarApiException

from .pypolestar.polestar import PolestarApi

from urllib3 import disable_warnings
Expand Down Expand Up @@ -45,7 +47,10 @@ def get_latest_call_code(self):
return self.polestarApi.latest_call_code

async def async_update(self) -> None:
await self.polestarApi.get_ev_data(self.vin)
try:
await self.polestarApi.get_ev_data(self.vin)
except PolestarApiException as e:
_LOGGER.warning("API Exception on update data %s", str(e))

def get_value(self, query: str, field_name: str, skip_cache: bool = False):
data = self.polestarApi.get_cache_data(query, field_name, skip_cache)
Expand Down

0 comments on commit 846d975

Please sign in to comment.