[or-cvs] [pytorctl/master 2/5] Don't ignore unknown exceptions raised by get_router.

mikeperry at torproject.org mikeperry at torproject.org
Fri Aug 20 20:46:12 UTC 2010


Author: Harry Bock <hbock at ele.uri.edu>
Date: Sun, 1 Aug 2010 21:18:23 -0400
Subject: Don't ignore unknown exceptions raised by get_router.
Commit: 834ee75419ca4200ab33621d8c7f01fa1d87609f

If an unknown exception is raised on one NS document during
read_routers, it's very likely it's going to be raised again on the
next, and the next... (e.g., TorCtlClosed).

Instead of printing out the traceback and continuing, allow it to
unwind the stack and let the caller handle it.
---
 TorCtl.py |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/TorCtl.py b/TorCtl.py
index 61ecf6e..65b5608 100755
--- a/TorCtl.py
+++ b/TorCtl.py
@@ -843,15 +843,13 @@ class Connection:
     for ns in nslist:
       try:
         r = self.get_router(ns)
-        if r: new.append(r)
+        if r:
+          new.append(r)
       except ErrorReply:
         bad_key += 1
         if "Running" in ns.flags:
           plog("NOTICE", "Running router "+ns.nickname+"="
              +ns.idhex+" has no descriptor")
-      except:
-        traceback.print_exception(*sys.exc_info())
-        continue
   
     return new
 
-- 
1.7.1




More information about the tor-commits mailing list