Error catching on failed gui load after a forced sync. And added connection type setting

This commit is contained in:
SimplifiedPrivacy 2026-08-05 03:04:35 -04:00
parent 1d886728e0
commit 40eba5b41b

View file

@ -7,6 +7,7 @@ from core.models.DatabaseOperation import DatabaseOperation, DBErrorType
from core.models.manage.migrations import migrate_sql from core.models.manage.migrations import migrate_sql
from core.models.manage.clear_sql_model import clear_sql_model from core.models.manage.clear_sql_model import clear_sql_model
from core.controllers.SyncController import new_sync from core.controllers.SyncController import new_sync
from core.controllers.ConfigurationController import ConfigurationController
from essentials.observers.ConnectionObserver import ConnectionObserver from essentials.observers.ConnectionObserver import ConnectionObserver
from core.observers.ClientObserver import ClientObserver from core.observers.ClientObserver import ClientObserver
@ -86,18 +87,20 @@ def emergency_sync():
client_observer = ClientObserver() client_observer = ClientObserver()
connection_observer = ConnectionObserver() connection_observer = ConnectionObserver()
if option == 1 or option == 2: if option == 1:
# # setup the function to do: ConfigurationController.set_connection("system")
do_this_function = partial(new_sync, client_observer, connection_observer) elif option == 2:
ConfigurationController.set_connection("tor")
sync_worked = show_terminal( # setup the function to be able to have the UI background thread run it.
do_this_function=do_this_function, do_this_function = partial(new_sync, client_observer, connection_observer)
connection_observer=connection_observer,
client_observer=client_observer return show_terminal(
) do_this_function=do_this_function,
connection_observer=connection_observer,
client_observer=client_observer
)
if sync_worked:
print("it worked")
# ============================================================================ # ============================================================================
# BEGIN PROGRAM # BEGIN PROGRAM
@ -153,7 +156,12 @@ if not main_db_exists:
create_ONLY_db_version_table() create_ONLY_db_version_table()
from gui.main_ui import start_ui from gui.main_ui import start_ui
start_ui(force_sync=False) try:
start_ui(force_sync=False)
except Exception as e:
error_msg = f"Critical Error with loading UI: {str(e)}"
logger.error(error_msg)
recovery_dialog(error_msg, "Sync Error")
sys.exit() sys.exit()