Revision: 5538
Author: nicdumz
Date: 2008-06-08 21:38:17 +0000 (Sun, 08 Jun 2008)
Log Message:
-----------
Erm. This sort of error handling :
except Exception, e:
output(unicode(e))
should really be avoided, please. Having a traceback is critical for debugging.
Sometimes catching all the Exceptions is necessary, but we usually don't want to to verbose, do we ?
Here, I don't really understand to catch all these Exception. However, I'm only adding a traceback.print_exc()
(For the record, I spent... too much time adding random traceback.print_trace to wikipedia.py to debug the isPublic() bug I attempted to fix in r5535, because it was dying with an unmeaningful error message)
Modified Paths:
--------------
trunk/pywikipedia/pagegenerators.py
Modified: trunk/pywikipedia/pagegenerators.py
===================================================================
--- trunk/pywikipedia/pagegenerators.py 2008-06-08 21:22:38 UTC (rev 5537)
+++ trunk/pywikipedia/pagegenerators.py 2008-06-08 21:38:17 UTC (rev 5538)
@@ -129,7 +129,7 @@
# Standard library imports
import re, codecs, sys
-import threading, Queue
+import threading, Queue, traceback
import urllib, urllib2, time
# Application specific imports
@@ -768,6 +768,7 @@
for loaded_page in self.preload(somePages):
yield loaded_page
except Exception, e:
+ traceback.print_exc()
wikipedia.output(unicode(e))
def preload(self, page_list):