From 023eb5a8daa8b0634238bd3731a7dd66529e401c Mon Sep 17 00:00:00 2001 From: Marin Visscher <103424764+mrvisscher@users.noreply.github.com> Date: Tue, 26 Nov 2024 10:34:10 +0100 Subject: [PATCH] Add `ConnectionError` and general Exception clauses to `ProjectSetupWizard` (#1412) --- activity_browser/ui/wizards/project_setup_wizard.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/activity_browser/ui/wizards/project_setup_wizard.py b/activity_browser/ui/wizards/project_setup_wizard.py index a572f54b1..f917c5a13 100644 --- a/activity_browser/ui/wizards/project_setup_wizard.py +++ b/activity_browser/ui/wizards/project_setup_wizard.py @@ -148,7 +148,6 @@ def validatePage(self): release = ei.EcoinventRelease(settings) release.list_versions() - # logon was unsuccesful except requests.exceptions.HTTPError as e: QtWidgets.QApplication.restoreOverrideCursor() @@ -161,6 +160,16 @@ def validatePage(self): self.message.setText("Unknown connection error, try again later.") raise e + except requests.exceptions.ConnectionError: + QtWidgets.QApplication.restoreOverrideCursor() + self.message.setText("Cannot connect to the internet, please try again later.") + return False + + except Exception as e: + # restore cursor on all exceptions + QtWidgets.QApplication.restoreOverrideCursor() + raise e + # in case of success, set the settings for permanent use ei.permanent_setting("username", self.username.text()) ei.permanent_setting("password", self.password.text())