Skip to content

Commit

Permalink
Handled invalid countries more tidily
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerSelwyn committed May 16, 2020
1 parent 657bca1 commit c0f67d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyskyqremote/skyq_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,13 +521,13 @@ def _importCountry(self, deviceInfo):
if alpha3 in KNOWN_COUNTRIES:
alpha3 = KNOWN_COUNTRIES[alpha3]

country = pycountry.countries.get(alpha_3=alpha3).alpha_2.casefold()
try:
country = pycountry.countries.get(alpha_3=alpha3).alpha_2.casefold()
return importlib.import_module(
"pyskyqremote.country.remote_" + country
).SkyQCountry

except Exception as err:
except (AttributeError, ModuleNotFoundError) as err:
_LOGGER.warning(
f"W0030 - Invalid country, defaulting to GBR : {self._host} : {alpha3} : {err}"
)
Expand Down

0 comments on commit c0f67d7

Please sign in to comment.