wsgi silently swallows errors

R

Ron Garret

Consider the following wsgi app:

def application(env, start_response):
start_response('200 OK',[('Content-type','text/plain')])
yield "hello"
x=1/0
yield "world"

The result of this is that the web browser displays "hello" and an error
message ends up in the web log. But there is no other indication that
an error has occurred.

Is there any way to get WSGI to not silently swallow errors that occur
after start_response has been called?

Thanks,
rg
 
Ð

Дамјан ГеоргиевÑки

Consider the following wsgi app:

def application(env, start_response):
start_response('200 OK',[('Content-type','text/plain')])
yield "hello"
x=1/0
yield "world"

The result of this is that the web browser displays "hello" and an
error
message ends up in the web log. But there is no other indication that
an error has occurred.

Is there any way to get WSGI to not silently swallow errors that occur
after start_response has been called?

yes, you can wrap your app in a WebError middleware
http://pypi.python.org/pypi/WebError

from weberror.evalexception import EvalException
application = EvalException(application)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top