Commits

Anonymous committed 061b637

Better formatting of tracebacks: the page handler is now included at the top. That way the error it still a string and not a tuple so an error message can be on multiple lines and it gets displayed fine in the browser

Comments (0)

Files changed (1)

cherrypy/_cputil.py

     
     if exc == (None, None, None):
         return ""
-    return "".join(traceback.format_exception(*exc))
+    args = exc[1].args
+    page_handler = args[-1]
+    page_handler_str = 'Page handler: %s\n' % repr(page_handler)
+    args = args[:-1]
+    exc[1].args = args
+    return page_handler_str + "".join(traceback.format_exception(*exc))
 
 def bareError(extrabody=None):
     """Produce status, headers, body for a critical error.