[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [ooni-probe/master] Handle also unhandled exceptions when starting the director.
commit 27f8f55d42d83174762cffab018638342a6f7ca1
Author: Arturo Filastò <art@xxxxxxxxx>
Date: Sat May 31 20:27:56 2014 +0200
Handle also unhandled exceptions when starting the director.
---
ooni/oonicli.py | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/ooni/oonicli.py b/ooni/oonicli.py
index e29d20a..efcc7db 100644
--- a/ooni/oonicli.py
+++ b/ooni/oonicli.py
@@ -204,13 +204,15 @@ def runWithDirector(logging=True, start_tor=True):
except errors.UnableToLoadDeckInput as error:
return defer.failure.Failure(error)
- def director_startup_failed(failure):
- log.err("Failed to start the director")
- r = failure.trap(errors.TorNotRunning,
- errors.InvalidOONIBCollectorAddress,
- errors.UnableToLoadDeckInput, errors.CouldNotFindTestHelper,
- errors.CouldNotFindTestCollector, errors.ProbeIPUnknown,
- errors.InvalidInputFile)
+ def director_startup_handled_failures(failure):
+ log.err("Could not start the director")
+ failure.trap(errors.TorNotRunning,
+ errors.InvalidOONIBCollectorAddress,
+ errors.UnableToLoadDeckInput,
+ errors.CouldNotFindTestHelper,
+ errors.CouldNotFindTestCollector,
+ errors.ProbeIPUnknown,
+ errors.InvalidInputFile)
if isinstance(failure.value, errors.TorNotRunning):
log.err("Tor does not appear to be running")
@@ -245,6 +247,10 @@ def runWithDirector(logging=True, start_tor=True):
if config.advanced.debug:
log.exception(failure)
+ def director_startup_other_failures(failure):
+ log.err("An unhandled exception occurred while starting the director!")
+ log.exception(failure)
+
# Wait until director has started up (including bootstrapping Tor)
# before adding tests
def post_director_start(_):
@@ -292,7 +298,8 @@ def runWithDirector(logging=True, start_tor=True):
def start():
d.addCallback(setup_nettest)
d.addCallback(post_director_start)
- d.addErrback(director_startup_failed)
+ d.addErrback(director_startup_handled_failures)
+ d.addErrback(director_startup_other_failures)
return d
return start()
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits