mirror of
https://github.com/onionshare/onionshare.git
synced 2025-08-19 19:38:46 -04:00
Generalize the handling of Tor exceptions, more logging in Web
This commit is contained in:
parent
c939d9b214
commit
a09bfdb2cc
3 changed files with 8 additions and 6 deletions
|
@ -112,11 +112,11 @@ def main(cwd=None):
|
||||||
onion = Onion(common)
|
onion = Onion(common)
|
||||||
try:
|
try:
|
||||||
onion.connect(custom_settings=False, config=config)
|
onion.connect(custom_settings=False, config=config)
|
||||||
except (TorTooOld, TorErrorInvalidSetting, TorErrorAutomatic, TorErrorSocketPort, TorErrorSocketFile, TorErrorMissingPassword, TorErrorUnreadableCookieFile, TorErrorAuthError, TorErrorProtocolError, BundledTorNotSupported, BundledTorTimeout) as e:
|
|
||||||
sys.exit(e.args[0])
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("")
|
print("")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
except Exception as e:
|
||||||
|
sys.exit(e.args[0])
|
||||||
|
|
||||||
# Start the onionshare app
|
# Start the onionshare app
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -417,11 +417,13 @@ class Web(object):
|
||||||
'data': data
|
'data': data
|
||||||
})
|
})
|
||||||
|
|
||||||
def generate_slug(self, persistent_slug=''):
|
def generate_slug(self, persistent_slug=None):
|
||||||
if persistent_slug:
|
self.common.log('Web', 'generate_slug', 'persistent_slug={}'.format(persistent_slug))
|
||||||
|
if persistent_slug != None:
|
||||||
self.slug = persistent_slug
|
self.slug = persistent_slug
|
||||||
else:
|
else:
|
||||||
self.slug = self.common.build_slug()
|
self.slug = self.common.build_slug()
|
||||||
|
self.common.log('Web', 'generate_slug', 'slug is set to {}'.format(self.slug))
|
||||||
|
|
||||||
def debug_mode(self):
|
def debug_mode(self):
|
||||||
"""
|
"""
|
||||||
|
@ -449,7 +451,7 @@ class Web(object):
|
||||||
raise RuntimeError('Not running with the Werkzeug Server')
|
raise RuntimeError('Not running with the Werkzeug Server')
|
||||||
func()
|
func()
|
||||||
|
|
||||||
def start(self, port, stay_open=False, persistent_slug=''):
|
def start(self, port, stay_open=False, persistent_slug=None):
|
||||||
"""
|
"""
|
||||||
Start the flask web server.
|
Start the flask web server.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -142,7 +142,7 @@ class Mode(QtWidgets.QWidget):
|
||||||
self.app.start_onion_service()
|
self.app.start_onion_service()
|
||||||
self.starting_server_step2.emit()
|
self.starting_server_step2.emit()
|
||||||
|
|
||||||
except (TorTooOld, TorErrorInvalidSetting, TorErrorAutomatic, TorErrorSocketPort, TorErrorSocketFile, TorErrorMissingPassword, TorErrorUnreadableCookieFile, TorErrorAuthError, TorErrorProtocolError, BundledTorTimeout, OSError) as e:
|
except Exception as e:
|
||||||
self.starting_server_error.emit(e.args[0])
|
self.starting_server_error.emit(e.args[0])
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue