splash_screen: show detailed error when moonraker connection fails

This commit is contained in:
alfrix 2022-11-21 07:15:02 -03:00
parent bdd3e0ba1b
commit 818f1ab465
3 changed files with 13 additions and 8 deletions

View File

@ -8,6 +8,7 @@ class KlippyRest:
self.ip = ip
self.port = port
self.api_key = api_key
self.status = ''
@property
def endpoint(self):
@ -44,15 +45,19 @@ class KlippyRest:
else:
data = response.content
except requests.exceptions.HTTPError as h:
logging.error(h)
self.status = h
except requests.exceptions.ConnectionError as c:
logging.error(c)
self.status = c
except requests.exceptions.Timeout as t:
logging.error(t)
self.status = t
except requests.exceptions.JSONDecodeError as j:
logging.error(j)
self.status = j
except requests.exceptions.RequestException as r:
logging.error(r)
self.status = r
except Exception as e:
logging.error(e)
self.status = e
if data:
self.status = ''
else:
logging.error(self.status)
return data

View File

@ -159,7 +159,7 @@ class KlippyWebsocket(threading.Thread):
self.connecting = False
self._screen.printer_initializing(
_("Cannot connect to Moonraker")
+ f'\n\n{self._url}')
+ f'\n\n{self._url}\n\n{self._screen.apiclient.status}')
return False
logging.debug("Attempting to reconnect")
self.connect()

View File

@ -62,7 +62,7 @@ class SplashScreenPanel(ScreenPanel):
self.content.add(main)
def update_text(self, text):
self.labels['text'].set_markup(f"{text}")
self.labels['text'].set_label(f"{text}")
self.show_restart_buttons()
def clear_action_bar(self):