aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Weth <git@jonathanweth.de>2021-06-28 12:56:12 +0200
committerJonathan Weth <git@jonathanweth.de>2021-06-28 12:56:12 +0200
commit3712174c2d02b4a629e7ce0cbb7e8d3bd502d36b (patch)
tree7c5f0ebfebcf355f08737273884862b4b6095221
parentd81082efdea8b603914f04b6690d11c28fc8fcf7 (diff)
downloadRWA.Support.SessionService-3712174c2d02b4a629e7ce0cbb7e8d3bd502d36b.tar.gz
RWA.Support.SessionService-3712174c2d02b4a629e7ce0cbb7e8d3bd502d36b.tar.bz2
RWA.Support.SessionService-3712174c2d02b4a629e7ce0cbb7e8d3bd502d36b.zip
Log connection errors in service better
-rwxr-xr-xrwa/support/sessionservice/service.py2
-rw-r--r--rwa/support/sessionservice/session.py10
2 files changed, 6 insertions, 6 deletions
diff --git a/rwa/support/sessionservice/service.py b/rwa/support/sessionservice/service.py
index 3e9900d..a6e6aa1 100755
--- a/rwa/support/sessionservice/service.py
+++ b/rwa/support/sessionservice/service.py
@@ -121,7 +121,7 @@ class RWASupportSessionService(dbus.service.Object):
return json.dumps(return_json)
except ConnectionError:
- pass
+ logging.error("There was a connection error while trying to reach the server.")
return json.dumps({"status": "error", "type": "connection"})
diff --git a/rwa/support/sessionservice/session.py b/rwa/support/sessionservice/session.py
index cabef5f..d3a6fd8 100644
--- a/rwa/support/sessionservice/session.py
+++ b/rwa/support/sessionservice/session.py
@@ -148,21 +148,21 @@ class Session:
self.stop(triggered=True)
raise ConnectionError()
+ if r.status_code != 200:
+ self.stop(triggered=True)
+ raise ConnectionError()
+
logging.info(
"The session has been registered in RWA.Support.WebApp "
f"with status code {r.status_code} and response {r.content.decode()}."
)
- if r.status_code != 200:
- self.stop(triggered=True)
- raise ConnectionError()
-
self.meta = r.json()
self.session_id = self.meta["session_id"]
self.web_url = self.meta["url"]
self.api_token = self.meta["token"]
else:
- logging.info("The session has pretended that he had created a session.")
+ logging.info("The service has pretended that he had created a session.")
self.meta = {}
self.session_id = int(random_digits(10))
self.web_url = f"http://example.com:{random_digits(5)}/app/rwasupport/test/"