From 8812472b5381bae00375be34a00ccb3e2da63c26 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 14 Nov 2013 11:14:21 +0900 Subject: [PATCH] catch "no such file or directory" error when connecting with no net soren reports it happening on his computer; can't repro it here also make sure exception is always converted to string in reliable way --- aqt/sync.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/aqt/sync.py b/aqt/sync.py index 8fc9bb1f1..c3d09a6bf 100644 --- a/aqt/sync.py +++ b/aqt/sync.py @@ -337,12 +337,9 @@ class SyncThread(QThread): ret = self.client.sync() except Exception, e: log = traceback.format_exc() - try: - err = unicode(e[0], "utf8", "ignore") - except: - # number, exception with no args, etc - err = "" - if "Unable to find the server" in err: + err = repr(str(e)) + if ("Unable to find the server" in err or + "Errno 2" in err): self.fireEvent("offline") else: if not err: