mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Generalize the handling of Tor exceptions, more logging in Web
This commit is contained in:
parent
5d037a78fa
commit
1456361566
@ -112,11 +112,11 @@ def main(cwd=None):
|
||||
onion = Onion(common)
|
||||
try:
|
||||
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:
|
||||
print("")
|
||||
sys.exit()
|
||||
except Exception as e:
|
||||
sys.exit(e.args[0])
|
||||
|
||||
# Start the onionshare app
|
||||
try:
|
||||
|
@ -417,11 +417,13 @@ class Web(object):
|
||||
'data': data
|
||||
})
|
||||
|
||||
def generate_slug(self, persistent_slug=''):
|
||||
if persistent_slug:
|
||||
def generate_slug(self, persistent_slug=None):
|
||||
self.common.log('Web', 'generate_slug', 'persistent_slug={}'.format(persistent_slug))
|
||||
if persistent_slug != None:
|
||||
self.slug = persistent_slug
|
||||
else:
|
||||
self.slug = self.common.build_slug()
|
||||
self.common.log('Web', 'generate_slug', 'slug is set to {}'.format(self.slug))
|
||||
|
||||
def debug_mode(self):
|
||||
"""
|
||||
@ -449,7 +451,7 @@ class Web(object):
|
||||
raise RuntimeError('Not running with the Werkzeug Server')
|
||||
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.
|
||||
"""
|
||||
|
@ -142,7 +142,7 @@ class Mode(QtWidgets.QWidget):
|
||||
self.app.start_onion_service()
|
||||
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])
|
||||
return
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user