Merge pull request from onionshare/mig/catch-generic-exception

Catch general Exception in the UI when trying to connect or start a share, and raise as Alert
This commit is contained in:
Saptak Sengupta 2025-02-18 21:30:07 +05:30 committed by GitHub
commit 1014fc538d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 0 deletions
desktop/onionshare

@ -247,6 +247,7 @@
"error_port_not_available": "OnionShare port not available",
"history_receive_read_message_button": "Read Message",
"error_tor_protocol_error": "There was an error with Tor: {}",
"error_generic": "There was an unexpected error with OnionShare:\n{}",
"moat_contact_label": "Contacting BridgeDB…",
"moat_captcha_label": "Solve the CAPTCHA to request a bridge.",
"moat_captcha_placeholder": "Enter the characters from the image",

@ -106,6 +106,11 @@ class OnionThread(QtCore.QThread):
message = self.mode.common.gui.get_translated_tor_error(e)
self.error.emit(message)
return
except Exception as e:
# Handle any other error that wasn't in the list above
message = strings._("error_generic").format(e.args[0])
self.error.emit(message)
return
class WebThread(QtCore.QThread):

@ -210,6 +210,12 @@ class TorConnectionThread(QtCore.QThread):
)
self.error_connecting_to_tor.emit(message)
except Exception as e:
# Handle any other error that wasn't in the list above
message = strings._("error_generic").format(e.args[0])
self.error_connecting_to_tor.emit(message)
return
def _tor_status_update(self, progress, summary):
self.tor_status_update.emit(progress, summary)