File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 1010from typing import Dict , List , Optional , Type
1111import urllib .parse
1212
13- from aiohttp import ClientSession , ClientTimeout
13+ from aiohttp import ClientConnectionError , ClientSession , ClientTimeout
1414from aiohttp .connector import TCPConnector
1515import humps
1616
3333 AccessRestrictionException ,
3434 AuthenticationException ,
3535 BadRequestException ,
36+ LoginConnectionException ,
3637 LoginTimeoutException ,
3738 MaximumSessionCountException ,
3839 NonWritableParameterException ,
@@ -272,6 +273,10 @@ async def login(self):
272273 raise LoginTimeoutException (
273274 "Request timed-out. This is mainly due to using the wrong encryption method."
274275 ) from exception
276+ except ClientConnectionError as exception :
277+ raise LoginConnectionException (
278+ "Unable to connect to the device. Please check the host address."
279+ ) from exception
275280
276281 data = self .__get_response (response )
277282
Original file line number Diff line number Diff line change @@ -20,6 +20,12 @@ class LoginTimeoutException(Exception):
2020 pass
2121
2222
23+ class LoginConnectionException (Exception ):
24+ """Raised when a connection error is encountered during login."""
25+
26+ pass
27+
28+
2329class NonWritableParameterException (Exception ):
2430 """Raised when provided parameter is not writable."""
2531
You can’t perform that action at this time.
0 commit comments