wsgi silently swallows errors

Discussion in 'Python' started by Ron Garret, Jan 19, 2009.

  1. Ron Garret

    Ron Garret Guest

    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
     
    Ron Garret, Jan 19, 2009
    #1
    1. Advertising


  2. > 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.
     
    Дамјан ГеоргиевÑки, Jan 20, 2009
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ronald Fischer

    JSP silently fails to compile

    Ronald Fischer, Oct 13, 2003, in forum: Java
    Replies:
    9
    Views:
    538
    John C. Bollinger
    Oct 21, 2003
  2. lovecreatesbeauty
    Replies:
    2
    Views:
    423
    codigo
    Apr 25, 2005
  3. Replies:
    1
    Views:
    322
    David Dorward
    Jul 28, 2006
  4. T
    Replies:
    0
    Views:
    384
  5. WuBin
    Replies:
    2
    Views:
    796
    Jeff Dillon
    Aug 21, 2008
Loading...

Share This Page