Exceptions

If an error occurs, the API attempts to roll the error into an appropriate Exception class.

Exception Classes

exception ApiError(message=None, original_exception=None)

Base class for all CBC SDK errors; also raised for generic internal errors.

Initialize the ApiError.

Parameters:
  • message (str) – The actual error message.

  • original_exception (Exception) – The exception that caused this one to be raised.

exception CredentialError(message=None, original_exception=None)

The credentials had an unspecified error.

Initialize the ApiError.

Parameters:
  • message (str) – The actual error message.

  • original_exception (Exception) – The exception that caused this one to be raised.

exception ServerError(error_code, message, **kwargs)

A ServerError is raised when an HTTP 5xx error code is returned from the Carbon Black server.

Initialize the ServerError.

Parameters:
  • error_code (int) – The error code that was received from the server.

  • message (str) – The actual error message.

  • kwargs (dict) – Additional arguments, which may include ‘result’ (server operation result), ‘original_exception’ (exception causing this one to be raised), and ‘uri’ (URI being accessed when this error was raised).

exception ObjectNotFoundError(uri, message=None, original_exception=None)

The requested object could not be found in the Carbon Black datastore.

Initialize the ObjectNotFoundError.

Parameters:
  • uri (str) – The URI of the action that failed.

  • message (str) – The error message.

  • original_exception (Exception) – The exception that caused this one to be raised.

exception MoreThanOneResultError(message=None, original_exception=None, results=None)

Only one object was requested, but multiple matches were found in the Carbon Black datastore.

Initialize the MoreThanOneResultError.

Parameters:
  • message (str) – The actual error message.

  • original_exception (Exception) – The exception that caused this one to be raised.

  • results (list) – List of results returned

exception InvalidObjectError(message=None, original_exception=None)

An invalid object was received by the server.

Initialize the ApiError.

Parameters:
  • message (str) – The actual error message.

  • original_exception (Exception) – The exception that caused this one to be raised.

exception TimeoutError(uri=None, error_code=None, message=None, original_exception=None)

A requested operation timed out.

Initialize the TimeoutError.

Parameters:
  • uri (str) – The URI of the action that timed out.

  • error_code (int) – The error code that was received from the server.

  • message (str) – The error message.

  • original_exception (Exception) – The exception that caused this one to be raised.