# `exceptions` module

The **`exceptions` module** provides a standardized framework for error handling
within the platform. It includes specialized exception classes for actions,
connectors, jobs, and Google Cloud operations, allowing developers to catch and
respond to specific failure scenarios with precision.

The following example demonstrates how to import and raise a specific error from
this module:

    from TIPCommon.exceptions import ConnectorProcessingError
    raise ConnectorProcessingError('spam and eggs')

## Action exceptions

These exceptions handle errors that occur during the lifecycle of an action,
from initialization to data reporting.

| Exceptions ||
|---|---|
| `GeneralActionException` | Bases: `Exception` Serves as the base class for all action-related exceptions. |
| `ActionSetupError` | Bases: `GeneralActionException` Indicates an error during the initialization of an action. |
| `CaseResultError` | Bases: `GeneralActionException` Occurs when errors happen while sending data to a case result. |
| `EnrichActionError` | Bases: `GeneralActionException` Occurs when errors happen in an enrichment action. |
| `SDKWrapperError` | Bases: `GeneralActionException` Occurs when errors happen in SDK method wrappers. |
| `JobSetupError` | Bases: `GeneralActionException` Indicates a job initialization error. |

## Connector exceptions

These exceptions manage failure states specifically related to data connectors
and their processing logic.

| Exceptions ||
|---|---|
| `GeneralConnectorException` | Bases: `Exception` Serves as the base class for all connector-related exceptions. |
| `ConnectorSetupError` | Bases: `GeneralConnectorException` Indicates a failure during the initialization of a connector. |
| `ConnectorContextError` | Bases: `GeneralConnectorException` Indicates an error within the connector context. |
| `ConnectorProcessingError` | Bases: `GeneralConnectorException` Indicates a failure during the data processing phase of a connector. |
| `ConnectorValidationError` | Bases: `GeneralConnectorException` Indicates that the connector encounters a validation error. |

## Google Cloud exceptions

These exceptions map to specific error states encountered when interacting with
Google Cloud resources.

| Exceptions ||
|---|---|
| `GoogleCloudException` | Bases: `Exception` Serves as the general base class for Google Cloud errors. |
| `AlreadyExistsError` | Bases: `GoogleCloudException` Occurs when a Google Cloud resource already exists. |
| `NotFoundError` | Bases: `GoogleCloudException` Occurs when a Google Cloud resource isn't found. |
| `PermissionDeniedError` | Bases: `GoogleCloudException` Occurs when the client lacks permission to perform the operation on the resource. |
| `UnauthenticatedError` | Bases: `GoogleCloudException` Occurs when the client isn't authenticated properly. |
| `DeadlineExceededError` | Bases: `GoogleCloudException` Occurs when the request does not complete in the time allocated. |
| `ResourceExhaustedError` | Bases: `GoogleCloudException` Indicates that the quota for the cloud project is exceeded or there are too many concurrent requests from the client. |
| `BadGatewayError` | Bases: `GoogleCloudException` Indicates that a server between the client and the backend Google Cloud servers detects a temporary issue. |
| `UnavailableError` | Bases: `GoogleCloudException` Indicates the Google Cloud service is unable to process a request. |
| `InvalidArgumentError` | Bases: `GoogleCloudException` Indicates an invalid request to a Google Cloud resource. |
| `FailedPreconditionError` | Bases: `GoogleCloudException` Indicates a failed precondition error for a Google Cloud request. |
| `ImpersonationUnauthorizedError` | Bases: `GoogleCloudException` Indicates the caller isn't authorized to impersonate the service account. |

## General and utility exceptions

This section contains exceptions for general system errors, parameter
validation, and specialized data processing within Content Hub integrations.

| Exceptions ||
|---|---|
| `ParameterValidationError` | Bases: `Exception` Raised when a parameter is invalid. |
| `EmptyMandatoryValues` | Bases: `Exception` Indicates an exception for empty mandatory values. |
| `ParameterExtractionError` | Bases: `Exception` Indicates a parameter extraction error. |
| `OauthError` | Bases: `Exception` Raised when a generic exception occurs in the OAuth 2.0 flow. |
| `SMIMEMailError` | Bases: `Exception` Indicates a custom exception for S/MIME email processing errors. |
| `InternalJSONDecoderError` | Bases: `Exception` Indicates an internal JSON parsing error using `json.load` or `json.dump`. |
| `InvalidTimeException` | Bases: `Exception` Indicates an exception for invalid time. |
| `NotSupportedPlatformVersion` | Bases: `Exception` Indicates a custom exception for platform version errors that aren't supported. |
| `GeneralJobException` | Bases: `Exception` Serves as the general base class for job-related exceptions. |
| `RefreshTokenRenewalJobException` | Bases: `GeneralJobException` Indicates a failure in a `RefreshTokenRenewalJob` instance. |