Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

itty should output tracebacks to console #3

Closed
tstromberg opened this issue Jul 3, 2009 · 2 comments
Closed

itty should output tracebacks to console #3

tstromberg opened this issue Jul 3, 2009 · 2 comments

Comments

@tstromberg
Copy link

Patch against head included:

--- /home/tstromberg/workspace/betterdns/itty.py        2009-04-17 19:26:44.000000000 +0200
+++ ./itty.py   2009-07-03 16:30:07.878876000 +0200
@@ -25,6 +25,7 @@
 import os
 import re
 import sys
+import traceback
 import urlparse
 try:
     from urlparse import parse_qs
@@ -206,7 +207,11 @@
 
 def handle_error(exception, request):
     """If an exception is thrown, deal with it and present an error page."""
-    request._environ['wsgi.errors'].write("Exception occurred on '%s': %s\n" % (request._environ['PATH_INFO'], exception))
+    (e_type, e_value, e_tb) = sys.exc_info()
+    msg = ("%s occurred on '%s': %s\nTraceback: %s" %
+           (exception.__class__, request._environ['PATH_INFO'], exception,
+            ''.join(traceback.format_exception(e_type, e_value, e_tb))))
+    request._environ['wsgi.errors'].write(msg)
     
     if isinstance(exception, RequestError):
         status = getattr(exception, 'status', 404)
@toastdriven
Copy link
Owner

Sorry for the horrifically slow response. I never got a notification of this issue. I'll try to address it within the next week or so.

@toastdriven
Copy link
Owner

Fixed in SHA: d695710

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants