Catch general Exception in the UI when trying to connect or start a share, and raise as Alert

This commit is contained in:
Miguel Jacq 2025-02-18 16:35:47 +11:00
parent 063a8dc669
commit c1f06d99d7
No known key found for this signature in database
GPG Key ID: 59B3F0C24135C6A9
3 changed files with 12 additions and 0 deletions

View File

@ -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",

View File

@ -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):

View File

@ -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)