2

I'm running a python pyramid application and make restful calls to it. It's a wsgi app and uses waitress as the http server. Currently when I make a failing http request, I get messages like:

Internal Server Error
The server encountered an unexpected internal server error

How would I configure waitress or paster itself to get errors that show the stacktrace, like so:

Traceback (most recent call last):
  File "/.../pyramid/eggs/waitress-0.8.8-py2.7.egg/waitress/channel.py", line 337, in service
    task.service()
  File "/.../pyramid/eggs/waitress-0.8.8-py2.7.egg/waitress/task.py", line 173, in service
    self.execute()
  ...
  File "/.../pyramid/eggs/pyramid-1.4.5-py2.7.egg/pyramid/config/views.py", line 469, in _class_requestonly_view
    response = getattr(inst, attr)()
  File "/.../pyramid/dustin/views.py", line 139, in delete
    raise Exception('DELETE op failed; oid %s not found' % deleteItem)
Exception: DELETE op failed; oid 00x not found

My paster config is:

[app:main]
use = egg:myegg

pyramid.reload_templates = true
pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = true
pyramid.default_locale_name = es

couchdb.uri = http://couchdb-host:5984/
couchdb.db = myegg

[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 6543

# Begin logging configuration

[loggers]
keys = root

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = INFO
handlers = console

[handler_console]
class = StreamHandler
args = [sys.stdout]
level = DEBUG
formatter = generic

[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s

# End logging configuration
RoyM
  • 1,118
  • 1
  • 9
  • 28

1 Answers1

1

Could you use an Exception View to catch any exceptions, and return the stacktrace in the response? I've used something similar to catch all my Pyramid exceptions, log them, but then display back to the user a "friendly" error page renderer.

Peter Tirrell
  • 2,962
  • 4
  • 29
  • 52
  • Thanks Peter.. I was wondering if there was a way to tell the middleware to pass the stacktrace along.. a quick inspection tells me that it's waitress that "eats" the exception at present. – RoyM May 12 '14 at 14:57