Skip to content

Commit 691f8ec

Browse files
committed
Move SSL setup to initGui() and log errors instead of silencing them
- Remove the module-level setup_qgis_ssl_for_mergin_client() call; the auth manager is not guaranteed to be ready at import time - In initGui(), replace bare except Exception: pass with a logged warning so SSL setup failures are visible in the QGIS message log
1 parent ae3685b commit 691f8ec

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

Mergin/plugin.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,6 @@
6565
MERGIN_CLIENT_LOG = os.path.join(QgsApplication.qgisSettingsDirPath(), "mergin-client-log.txt")
6666
os.environ["MERGIN_CLIENT_LOG"] = MERGIN_CLIENT_LOG
6767

68-
try:
69-
# Best-effort early init; auth manager may not be ready yet so this may be a no-op.
70-
# The real call happens in initGui() and before each MerginClient creation.
71-
setup_qgis_ssl_for_mergin_client()
72-
except Exception:
73-
pass
74-
75-
7668
class MerginPlugin:
7769
def __init__(self, iface):
7870
self.iface = iface
@@ -123,8 +115,8 @@ def initGui(self):
123115

124116
try:
125117
setup_qgis_ssl_for_mergin_client()
126-
except Exception:
127-
pass
118+
except Exception as e:
119+
QgsApplication.messageLog().logMessage(f"Mergin Maps plugin: failed to set up SSL certificates: {e}")
128120

129121
if self.iface is not None:
130122
self.add_action(

0 commit comments

Comments
 (0)