Exception Hierarchy
Understanding the exception hierarchy is key to writing effective error-handling logic.Exception Reference
Client-Side Errors
These errors are raised by the client before an API request is made, indicating an issue with your code’s input or configuration.ArgusValueError
The base class for client-side validation errors.
- When it’s raised: When a function argument is invalid but has the correct type. For example, providing an improperly formatted API key, an empty list where one is not allowed (in strict mode), or trying to save data without an
asset_id. - How to handle: This is a programming error. Inspect the error message to understand the validation failure and correct the arguments being passed to the SDK method.
ArgusTypeError
Inherits from ArgusValueError.
- When it’s raised: When a function argument has the wrong Python type. For example, passing a string where a list is expected for
competitors. - How to handle: Correct the data type of the argument you are passing to match the method’s signature.
Network Errors
ArgusConnectionError
Indicates a failure to communicate with the Argus API at the network level.
- When it’s raised: On DNS failures, refused connections, request timeouts, or other network interruptions. This error is raised after the SDK’s internal retry mechanism has been exhausted.
- How to handle: This is often a transient issue. You can implement your own retry logic with a longer backoff period, check your server’s network connectivity, or verify that Argus API endpoints are reachable.
API Errors (ArgusAPIError)
This is the base class for all errors returned by the Argus API (i.e., HTTP status codes 4xx and 5xx). All ArgusAPIError subclasses contain valuable context for debugging.
Attributes:
status_code(int): The HTTP status code of the error response (e.g.,401,404).response_body(dict): The parsed JSON body of the error response from the API, which may contain a detailed error message.
ArgusAuthenticationError (Status 401)
Inherits from ArgusAPIError.
- When it’s raised: Your API key is invalid, expired, or missing.
- How to handle: Verify your API key in the Argus dashboard and ensure it is being correctly loaded and passed to the client.
ArgusPermissionError (Status 403)
Inherits from ArgusAPIError.
- When it’s raised: Your API key is valid but does not have permission to perform the requested action. The most common cause is a Free-tier key (
sk_) attempting to use a Platform-tier feature (likeasset_idorsave=True). - How to handle: Ensure you are using a Runtime Security Key (
rsk_) for platform features.
ArgusNotFoundError (Status 404)
Inherits from ArgusAPIError.
- When it’s raised: A specified resource could not be found. This almost always means an
asset_idyou provided does not exist in your Argus account. - How to handle: Double-check that the
asset_idis correct and exists in your Argus dashboard.
ArgusInternalServerError (Status 5xx)
Inherits from ArgusAPIError.
- When it’s raised: An unexpected error occurred on the Argus servers.
- How to handle: This is a server-side issue. It is safe to retry the request after a short delay (e.g., using an exponential backoff strategy). If the problem persists, contact Argus support and provide the
request_idfrom the failed call if available, as well as the error details.

