def catch_errors(application, environ, start_response, error_callback, ok_callback=None):
 try:
  app_iter = application(environ, start_response)
 except:
  error_callback(sys.exc_info())
  raise
 if (type(app_iter) in (list, tuple)):
  if ok_callback:
   ok_callback()
  return app_iter
 else:
  return _wrap_app_iter(app_iter, error_callback, ok_callback)

def catch_errors ( application , environ , start_response , error_callback , ok_callback = None ) : try : app_iter = application ( environ , start_response ) except : error_callback ( sys . exc_info ( ) ) raise if ( type ( app_iter ) in ( list , tuple ) ) : if ok_callback : ok_callback ( ) return app_iter else : return _wrap_app_iter ( app_iter , error_callback , ok_callback )
runs the application .