code: def handle_api_exceptions(self, method, *url_parts, **kwargs):
          
          # The outer part - about error handler
          assert method in ('HEAD', 'GET', 'POST', 'PATCH', 'DELETE')
          cursor_context = kwargs.pop('cursor_context', None)
          errorhandler = cursor_context.errorhandler if cursor_context else self.errorhandler
          catched_exceptions = (SalesforceError, requests.exceptions.RequestException) if errorhandler else ()
          try:
              return self.handle_api_exceptions_inter(method, *url_parts, **kwargs)
  
          except catched_exceptions:
              # nothing is catched usually and error handler not used
              exc_class, exc_value, _ = sys.exc_info()
              errorhandler(self, cursor_context, exc_class, exc_value)
              raise
docs: Call REST API and handle exceptions
          Params:
              method:  'HEAD', 'GET', 'POST', 'PATCH' or 'DELETE'
              url_parts: like in rest_api_url() method
              api_ver:   like in rest_api_url() method
              kwargs: other parameters passed to requests.request,
                  but the only notable parameter is: (... json=data)
  
                  that works like (...
                      headers = {'Content-Type': 'application/json'},
                      data=json.dumps(data))