parameters: (func)
return_statement: return wrapper
docstring: Decorator that catches InputErrors and returns an error page.
docstring_summary: Decorator that catches InputErrors and returns an error page.
docstring_tokens: Decorator that catches InputErrors and returns an error page .
function: def catch_error_as_http(func):
      """
      Decorator that catches InputErrors and returns an error page.
      """
      @wraps(func)
      def wrapper(*args, **kwargs):
          try:
              result = func(*args, **kwargs)
          except exps.InputError as e:
              logger.warning("An exception occurred processing request for '{}' while running {}. Caught as HTTP".format(args[0].path, func.__name__), exc_info=True)
              raise Http404
          except Http404:
              raise
          except Exception as e:
              logger.exception("An exception occurred processing request for '{}' while running {}. Caught as HTTP".format(args[0].path, func.__name__))
              return render_to_response(args[0], 'static/generic.html',
                               {"content": "There was an error processing your request: {}".format(str(e))})
          return result
      return wrapper
function_tokens: def catch_error_as_http ( func ) : @ wraps ( func ) def wrapper ( * args , * * kwargs ) : try : result = func ( * args , * * kwargs ) except exps . InputError as e : logger . warning ( "An exception occurred processing request for '{}' while running {}. Caught as HTTP" . format ( args [ 0 ] . path , func . __name__ ) , exc_info = True ) raise Http404 except Http404 : raise except Exception as e : logger . exception ( "An exception occurred processing request for '{}' while running {}. Caught as HTTP" . format ( args [ 0 ] . path , func . __name__ ) ) return render_to_response ( args [ 0 ] , 'static/generic.html' , { "content" : "There was an error processing your request: {}" . format ( str ( e ) ) } ) return result return wrapper