Skip to content

Commit ee3d041

Browse files
authored
Merge pull request #198 from plugwise/error_handling
Change raisetypes to match better to the errortype
2 parents 270ca19 + d588a78 commit ee3d041

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Changelog
22

3+
# v0.19.1: Smile & Stretch: line up error handling with Plugwise-beta
4+
35
# v0.19.0: Smile Adam & Anna: cooling-related updates
46
- Anna: replace `setpoint` with `setpoint_low` and `setpoint_high` when cooling is active
57
- Anna: update according to recent Anna-with-cooling firmware updates (info provided by Plugwise)

plugwise/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Plugwise module."""
22

3-
__version__ = "0.19.0"
3+
__version__ = "0.19.1"
44

55
from plugwise.smile import Smile
66
from plugwise.stick import Stick

plugwise/helper.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
ThermoLoc,
4949
)
5050
from .exceptions import (
51+
ConnectionFailedError,
5152
InvalidAuthentication,
5253
InvalidXMLError,
53-
PlugwiseError,
5454
ResponseError,
5555
)
5656
from .util import (
@@ -268,8 +268,13 @@ async def _request(
268268
)
269269
except ClientError as err: # ClientError is an ancestor class of ServerTimeoutError
270270
if retry < 1:
271-
LOGGER.error("Failed sending %s %s to Plugwise Smile", method, command)
272-
raise PlugwiseError(
271+
LOGGER.error(
272+
"Failed sending %s %s to Plugwise Smile, error: %s",
273+
method,
274+
command,
275+
err,
276+
)
277+
raise ConnectionFailedError(
273278
"Plugwise connection error, check log for more info."
274279
) from err
275280
return await self._request(command, retry - 1)

plugwise/smile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
SmileSwitches,
3737
)
3838
from .exceptions import (
39-
ConnectionFailedError,
4039
InvalidSetupError,
4140
PlugwiseError,
41+
ResponseError,
4242
UnsupportedDeviceError,
4343
)
4444
from .helper import SmileComm, SmileHelper, update_helper
@@ -312,7 +312,7 @@ async def connect(self) -> bool:
312312
an issue on http://github.com/plugwise/python-plugwise",
313313
result,
314314
)
315-
raise ConnectionFailedError("Plugwise error, check log for more info.")
315+
raise ResponseError("Plugwise error, check log for more info.")
316316

317317
# Check if Anna is connected to an Adam
318318
if "159.2" in models:
@@ -376,7 +376,7 @@ async def _smile_detect_legacy(self, result: etree, dsmrmain: etree) -> str:
376376
"Connected but no gateway device information found, please create \
377377
an issue on http://github.com/plugwise/python-plugwise"
378378
)
379-
raise ConnectionFailedError("Plugwise error, check log for more info.")
379+
raise ResponseError("Plugwise error, check log for more info.")
380380

381381
return model
382382

0 commit comments

Comments
 (0)