def catch_processing_exceptions(func):
 @wraps(func)
 def new_func(*args, **kw):
  'Executes ``func(*args, **kw)`` but catches\n        :exc:`ProcessingException`s.\n\n        '
  try:
   return func(*args, **kw)
  except ProcessingException as exception:
   kw = dict(((key, getattr(exception, key)) for key in ERROR_FIELDS))
   kw['code'] = kw.pop('code_')
   return error_response(cause=exception, **kw)
 return new_func

def catch_processing_exceptions ( func ) : @ wraps ( func ) def new_func ( * args , ** kw ) : try : return func ( * args , ** kw ) except ProcessingException as exception : kw = dict ( ( ( key , getattr ( exception , key ) ) for key in ERROR_FIELDS ) ) kw [ 'code' ] = kw . pop ( 'code_' ) return error_response ( cause = exception , ** kw ) return new_func
decorator that catches :exc:processingexceptions and subsequently returns a json-ified error response .