parameters: (application)
return_statement: return simplecatcher_app
docstring: A simple middleware that catches errors and turns them into simple
      tracebacks.
docstring_summary: A simple middleware that catches errors and turns them into simple
      tracebacks.
docstring_tokens: A simple middleware that catches errors and turns them into simple tracebacks .
function: def simplecatcher(application):
      """
      A simple middleware that catches errors and turns them into simple
      tracebacks.
      """
      def simplecatcher_app(environ, start_response):
          try:
              return application(environ, start_response)
          except:
              out = StringIO()
              traceback.print_exc(file=out)
              start_response('500 Server Error',
                             [('content-type', 'text/html')],
                             sys.exc_info())
              res = out.getvalue()
              return ['<h3>Error</h3><pre>%s</pre>'
                      % html_quote(res)]
      return simplecatcher_app
function_tokens: def simplecatcher ( application ) : def simplecatcher_app ( environ , start_response ) : try : return application ( environ , start_response ) except : out = StringIO ( ) traceback . print_exc ( file = out ) start_response ( '500 Server Error' , [ ( 'content-type' , 'text/html' ) ] , sys . exc_info ( ) ) res = out . getvalue ( ) return [ '<h3>Error</h3><pre>%s</pre>' % html_quote ( res ) ] return simplecatcher_app