code: def error_handling(cls, fn):
          
          def wrapper(*args, **kwargs):
              try:
                  result = fn(*args, **kwargs)
                  return result
              except InvalidRequestError as e:
                  write_exception(e)
  
                  if hasattr(e, 'request'):
                      write_error_message('request {0}'.format(repr(e.request)))
                  if hasattr(e, 'response'):
                      write_error_message('response {0}'.format(repr(e.response)))
  
                  raise e
          return wrapper
docs: Decorator to handle errors