aboutsummaryrefslogtreecommitdiff
path: root/desktop/src/onionshare/tor_connection_dialog.py
diff options
context:
space:
mode:
authorMicah Lee <micah@micahflee.com>2020-11-29 12:25:09 -0800
committerMicah Lee <micah@micahflee.com>2020-11-29 12:25:09 -0800
commit068b95f683f43420dacee9addd18d84fe6f3b11d (patch)
tree61c1ec9c1a11372aac92131dee8267af617fbaea /desktop/src/onionshare/tor_connection_dialog.py
parent7bcfe6cad11036feeb52b199a9f0736ff35e21d6 (diff)
downloadonionshare-068b95f683f43420dacee9addd18d84fe6f3b11d.tar.gz
onionshare-068b95f683f43420dacee9addd18d84fe6f3b11d.zip
All Tor-related that get thrown from the onionshare_cli.Onion object now get translated in the GUI
Diffstat (limited to 'desktop/src/onionshare/tor_connection_dialog.py')
-rw-r--r--desktop/src/onionshare/tor_connection_dialog.py41
1 files changed, 37 insertions, 4 deletions
diff --git a/desktop/src/onionshare/tor_connection_dialog.py b/desktop/src/onionshare/tor_connection_dialog.py
index d5fa72a0..a9201aed 100644
--- a/desktop/src/onionshare/tor_connection_dialog.py
+++ b/desktop/src/onionshare/tor_connection_dialog.py
@@ -18,9 +18,25 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
+import time
from PySide2 import QtCore, QtWidgets, QtGui
-from onionshare_cli.onion import *
+from onionshare_cli.onion import (
+ BundledTorCanceled,
+ TorErrorInvalidSetting,
+ TorErrorAutomatic,
+ TorErrorSocketPort,
+ TorErrorSocketFile,
+ TorErrorMissingPassword,
+ TorErrorUnreadableCookieFile,
+ TorErrorAuthError,
+ TorErrorProtocolError,
+ BundledTorTimeout,
+ BundledTorBroken,
+ TorTooOldEphemeral,
+ TorTooOldStealth,
+ PortNotAvailable,
+)
from . import strings
from .gui_common import GuiCommon
@@ -156,9 +172,26 @@ class TorConnectionThread(QtCore.QThread):
)
self.canceled_connecting_to_tor.emit()
- except Exception as e:
- self.common.log("TorConnectionThread", "run", f"caught exception: {e}")
- self.error_connecting_to_tor.emit(str(e))
+ except (
+ TorErrorInvalidSetting,
+ TorErrorAutomatic,
+ TorErrorSocketPort,
+ TorErrorSocketFile,
+ TorErrorMissingPassword,
+ TorErrorUnreadableCookieFile,
+ TorErrorAuthError,
+ TorErrorProtocolError,
+ BundledTorTimeout,
+ BundledTorBroken,
+ TorTooOldEphemeral,
+ TorTooOldStealth,
+ PortNotAvailable,
+ ) as e:
+ message = self.common.gui.get_translated_tor_error(e)
+ self.common.log(
+ "TorConnectionThread", "run", f"caught exception: {message}"
+ )
+ self.error_connecting_to_tor.emit(message)
def _tor_status_update(self, progress, summary):
self.tor_status_update.emit(progress, summary)