Skip to content

Commit 97b3c6f

Browse files
authored
improve error handling pro+ (#2373)
1 parent 187561d commit 97b3c6f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/helpermodules/exceptions/requests.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from requests import HTTPError
2-
from requests.exceptions import ConnectionError
2+
from requests.exceptions import ConnectionError, ReadTimeout
33

44
from helpermodules.exceptions.registry import ExceptionRegistry
55

@@ -8,6 +8,10 @@ def handle_connection_error(e: ConnectionError):
88
return "Die Verbindung zum Server {} ist fehlgeschlagen. Überprüfe Adresse und Netzwerk.".format(e.request.url)
99

1010

11+
def handle_read_timeout(e: ReadTimeout):
12+
return "Innerhalb des Timeouts wurde keine Anwort erhalten. Überprüfe Adresse und Netzwerk."
13+
14+
1115
def handle_http_error(e: HTTPError):
1216
code = e.response.status_code
1317
if 400 <= code < 500:
@@ -22,3 +26,4 @@ def handle_http_error(e: HTTPError):
2226
def register_request_exception_handlers(registry: ExceptionRegistry) -> None:
2327
registry.add(ConnectionError, handle_connection_error)
2428
registry.add(HTTPError, handle_http_error)
29+
registry.add(ReadTimeout, handle_read_timeout)

packages/modules/chargepoints/openwb_pro/chargepoint_module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __init__(self, config: OpenWBPro) -> None:
3939

4040
def set_internal_context_handlers(self, parent_cp, parent_hostname):
4141
self.fault_state = FaultState(ComponentInfo(
42-
parent_cp,
42+
self.config.id,
4343
"Ladepunkt "+str(self.config.id),
4444
"chargepoint",
4545
parent_id=parent_cp,

0 commit comments

Comments
 (0)