[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [sbws/master] scanner: store the error in the result



commit 90a882d5bac954fd0cb5ba641d305af366fcc681
Author: juga0 <juga@xxxxxxxxxx>
Date:   Sun Dec 9 11:38:22 2018 +0000

    scanner: store the error in the result
    
    The error that is returned by an exception, not a custom error.
    So that it's easier to debug what fails.
---
 sbws/core/scanner.py | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/sbws/core/scanner.py b/sbws/core/scanner.py
index ecc6934..6328f71 100644
--- a/sbws/core/scanner.py
+++ b/sbws/core/scanner.py
@@ -211,7 +211,8 @@ def measure_relay(args, conf, destinations, cb, rl, relay):
         log.debug('Could not build circuit involving %s', relay.nickname)
         msg = 'Unable to complete circuit'
         return [
-            ResultErrorCircuit(relay, circ_fps, dest.url, our_nick, msg=msg),
+            ResultErrorCircuit(relay, circ_fps, dest.url, our_nick,
+                               msg=reason),
         ]
     log.debug('Built circ %s %s for relay %s %s', circ_id,
               stem_utils.circuit_str(cb.controller, circ_id), relay.nickname,
@@ -238,10 +239,9 @@ def measure_relay(args, conf, destinations, cb, rl, relay):
         log.debug('Unable to measure RTT to %s via relay %s %s',
                   dest.url, relay.nickname, relay.fingerprint[0:8])
         cb.close_circuit(circ_id)
-        # TODO: Return a different/new type of ResultError?
-        msg = 'Something bad happened while measuring RTTs'
         return [
-            ResultErrorStream(relay, circ_fps, dest.url, our_nick, msg=msg),
+            ResultErrorStream(relay, circ_fps, dest.url, our_nick,
+                              msg=str(reason)),
         ]
     # SECOND: measure bandwidth
     bw_results, reason = measure_bandwidth_to_server(
@@ -250,10 +250,9 @@ def measure_relay(args, conf, destinations, cb, rl, relay):
         log.debug('Unable to measure bandwidth to %s via relay %s %s',
                   dest.url, relay.nickname, relay.fingerprint[0:8])
         cb.close_circuit(circ_id)
-        # TODO: Return a different/new type of ResultError?
-        msg = 'Something bad happened while measuring bandwidth'
         return [
-            ResultErrorStream(relay, circ_fps, dest.url, our_nick, msg=msg),
+            ResultErrorStream(relay, circ_fps, dest.url, our_nick,
+                              msg=str(reason)),
         ]
     cb.close_circuit(circ_id)
     # Finally: store result



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits