[tor-commits] [bridgedb/master] Print tracebacks on unhandled exceptions in gen_bridge_descriptors.

isis at torproject.org isis at torproject.org
Sun Jan 12 06:06:32 UTC 2014


commit a6aa71efc9d19504eaf8ab958baba23c5f2eb7f4
Author: Isis Lovecruft <isis at torproject.org>
Date:   Sat Nov 16 00:38:28 2013 +0000

    Print tracebacks on unhandled exceptions in gen_bridge_descriptors.
---
 scripts/gen_bridge_descriptors |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/scripts/gen_bridge_descriptors b/scripts/gen_bridge_descriptors
index 66f07ab..816340b 100644
--- a/scripts/gen_bridge_descriptors
+++ b/scripts/gen_bridge_descriptors
@@ -50,6 +50,7 @@ import sys
 import random
 import re
 import time
+import traceback
 
 from datetime import datetime
 from codecs   import open as open
@@ -821,10 +822,17 @@ def create(count):
     extrainfo_descriptors = list()
     try:
         for i in xrange(int(count)):
-            extrainfo, server, netstatus = generateDescriptors()
-            server_descriptors.append(server)
-            netstatus_consensus.append(netstatus)
-            extrainfo_descriptors.append(extrainfo)
+            print(".", end='')
+            try:
+                extrainfo, server, netstatus = generateDescriptors()
+            except Exception as error:
+                err, msg, tb = sys.exc_info()
+                print(traceback.print_tb(tb))
+                print(error)
+            else:
+                server_descriptors.append(server)
+                netstatus_consensus.append(netstatus)
+                extrainfo_descriptors.append(extrainfo)
     except KeyboardInterrupt as keyint:
         print("Received keyboard interrupt.")
         print("Stopping descriptor creation and exiting.")





More information about the tor-commits mailing list