Exceptions¶
If an error occurs, the API attempts to roll the error into an appropriate Exception class.
Exception Classes¶
-
exception
cbapi.errors.
ApiError
(message=None, original_exception=None)¶ Base class for all CBAPI errors; also raised for generic internal errors.
Initialize the ApiError.
- Args:
- message (str): The actual error message. original_exception (Exception): The exception that caused this one to be raised.
-
exception
cbapi.errors.
CredentialError
(message=None, original_exception=None)¶ The credentials had an unspecified error.
Initialize the ApiError.
- Args:
- message (str): The actual error message. original_exception (Exception): The exception that caused this one to be raised.
-
exception
cbapi.errors.
ServerError
(error_code, message, result=None, original_exception=None)¶ A ServerError is raised when an HTTP 5xx error code is returned from the Carbon Black server.
Initialize the ServerError.
- Args:
- error_code (int): The error code that was received from the server. message (str): The actual error message. result (object): The result of the operation from the server. original_exception (Exception): The exception that caused this one to be raised.
-
exception
cbapi.errors.
ObjectNotFoundError
(uri, message=None, original_exception=None)¶ The requested object could not be found in the Carbon Black datastore.
Initialize the ObjectNotFoundError.
- Args:
- 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
cbapi.errors.
MoreThanOneResultError
(message=None, original_exception=None)¶ Only one object was requested, but multiple matches were found in the Carbon Black datastore.
Initialize the ApiError.
- Args:
- message (str): The actual error message. original_exception (Exception): The exception that caused this one to be raised.
-
exception
cbapi.errors.
InvalidObjectError
(message=None, original_exception=None)¶ An invalid object was received by the server.
Initialize the ApiError.
- Args:
- message (str): The actual error message. original_exception (Exception): The exception that caused this one to be raised.
-
exception
cbapi.errors.
TimeoutError
(uri=None, error_code=None, message=None, original_exception=None)¶ A requested operation timed out.
Initialize the TimeoutError.
- Args:
- 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.