Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > wsgi silently swallows errors

Reply
Thread Tools

wsgi silently swallows errors

 
 
Ron Garret
Guest
Posts: n/a
 
      01-19-2009
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
 
Reply With Quote
 
 
 
 
Дамјан Георгиевски
Guest
Posts: n/a
 
      01-20-2009


> 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)


--
дамјан ( http://softver.org.mk/damjan/ )

In theory, there is no difference between theory and practice.
But, in practice, there is.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Drag operation swallows mouse events? T Java 0 03-03-2007 12:39 AM
HOYA SWALLOWS PENTAX ! RiceHigh Digital Photography 1090 01-08-2007 10:49 PM
Pelican swallows pigeon Daniel Silevitch Digital Photography 31 10-31-2006 05:04 PM
Errors, errors, errors Mark Goldin ASP .Net 2 01-17-2004 08:05 PM
How can I silently discard packets ? phil~~ Cisco 6 11-13-2003 01:02 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57