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. Advertisements


  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. Advertisements

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. Mark Goldin

    Errors, errors, errors

    Mark Goldin, Jan 17, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,280
    Mark Goldin
    Jan 17, 2004
  2. Ronald Fischer

    JSP silently fails to compile

    Ronald Fischer, Oct 13, 2003, in forum: Java
    Replies:
    9
    Views:
    701
    John C. Bollinger
    Oct 21, 2003
  3. lovecreatesbeauty
    Replies:
    2
    Views:
    520
    codigo
    Apr 25, 2005
  4. Replies:
    1
    Views:
    403
    David Dorward
    Jul 28, 2006
  5. T
    Replies:
    0
    Views:
    475
  6. WuBin
    Replies:
    2
    Views:
    895
    Jeff Dillon
    Aug 21, 2008
  7. Ben Phillips

    SwingWorker.execute() silently fails?

    Ben Phillips, Oct 8, 2008, in forum: Java
    Replies:
    3
    Views:
    780
    Ben Phillips
    Oct 9, 2008
  8. Marteno Rodia

    how to run s subprogram silently?

    Marteno Rodia, May 4, 2009, in forum: Java
    Replies:
    7
    Views:
    1,044
    Andrew Thompson
    May 5, 2009
Loading...