Module aws_lambda_powertools.utilities.idempotency.exceptions

Idempotency errors

Classes

class BaseError (*args: str | Exception | None)

Base error class that overwrites the way exception and extra information is printed. See https://github.com/aws-powertools/powertools-lambda-python/issues/1772

Expand source code
class BaseError(Exception):
    """
    Base error class that overwrites the way exception and extra information is printed.
    See https://github.com/aws-powertools/powertools-lambda-python/issues/1772
    """

    def __init__(self, *args: str | Exception | None):
        self.message = str(args[0]) if args else ""
        self.details = "".join(str(arg) for arg in args[1:]) if args[1:] else None

    def __str__(self):
        """
        Return all arguments formatted or original message
        """
        if self.message and self.details:
            return f"{self.message} - ({self.details})"
        return self.message

Ancestors

  • builtins.Exception
  • builtins.BaseException

Subclasses

class IdempotencyAlreadyInProgressError (*args: str | Exception | None)

Execution with idempotency key is already in progress

Expand source code
class IdempotencyAlreadyInProgressError(BaseError):
    """
    Execution with idempotency key is already in progress
    """

Ancestors

  • BaseError
  • builtins.Exception
  • builtins.BaseException
class IdempotencyInconsistentStateError (*args: str | Exception | None)

State is inconsistent across multiple requests to persistence store

Expand source code
class IdempotencyInconsistentStateError(BaseError):
    """
    State is inconsistent across multiple requests to persistence store
    """

Ancestors

  • BaseError
  • builtins.Exception
  • builtins.BaseException
class IdempotencyInvalidStatusError (*args: str | Exception | None)

An invalid status was provided

Expand source code
class IdempotencyInvalidStatusError(BaseError):
    """
    An invalid status was provided
    """

Ancestors

  • BaseError
  • builtins.Exception
  • builtins.BaseException
class IdempotencyItemAlreadyExistsError (*args: str | Exception | None, old_data_record: DataRecord | None = None)

Item attempting to be inserted into persistence store already exists and is not expired

Expand source code
class IdempotencyItemAlreadyExistsError(BaseError):
    """
    Item attempting to be inserted into persistence store already exists and is not expired
    """

    def __init__(self, *args: str | Exception | None, old_data_record: DataRecord | None = None):
        self.old_data_record = old_data_record
        super().__init__(*args)

    def __str__(self):
        """
        Return all arguments formatted or original message
        """
        old_data_record = f" from [{(str(self.old_data_record))}]" if self.old_data_record else ""
        message = super().__str__()
        return f"{message}{old_data_record}"

Ancestors

  • BaseError
  • builtins.Exception
  • builtins.BaseException
class IdempotencyItemNotFoundError (*args: str | Exception | None)

Item does not exist in persistence store

Expand source code
class IdempotencyItemNotFoundError(BaseError):
    """
    Item does not exist in persistence store
    """

Ancestors

  • BaseError
  • builtins.Exception
  • builtins.BaseException
class IdempotencyKeyError (*args: str | Exception | None)

Payload does not contain an idempotent key

Expand source code
class IdempotencyKeyError(BaseError):
    """
    Payload does not contain an idempotent key
    """

Ancestors

  • BaseError
  • builtins.Exception
  • builtins.BaseException
class IdempotencyModelTypeError (*args: str | Exception | None)

Model type does not match expected payload output

Expand source code
class IdempotencyModelTypeError(BaseError):
    """
    Model type does not match expected payload output
    """

Ancestors

  • BaseError
  • builtins.Exception
  • builtins.BaseException
class IdempotencyNoSerializationModelError (*args: str | Exception | None)

No model was supplied to the serializer

Expand source code
class IdempotencyNoSerializationModelError(BaseError):
    """
    No model was supplied to the serializer
    """

Ancestors

  • BaseError
  • builtins.Exception
  • builtins.BaseException
class IdempotencyPersistenceConfigError (*args: str | Exception | None)

The idempotency persistency configuration was unsupported

Expand source code
class IdempotencyPersistenceConfigError(BaseError):
    """
    The idempotency persistency configuration was unsupported
    """

Ancestors

  • BaseError
  • builtins.Exception
  • builtins.BaseException
class IdempotencyPersistenceConnectionError (*args: str | Exception | None)

Idempotency persistence connection error

Expand source code
class IdempotencyPersistenceConnectionError(BaseError):
    """
    Idempotency persistence connection error
    """

Ancestors

  • BaseError
  • builtins.Exception
  • builtins.BaseException
class IdempotencyPersistenceConsistencyError (*args: str | Exception | None)

Idempotency persistency consistency error, needs to be removed

Expand source code
class IdempotencyPersistenceConsistencyError(BaseError):
    """
    Idempotency persistency consistency error, needs to be removed
    """

Ancestors

  • BaseError
  • builtins.Exception
  • builtins.BaseException
class IdempotencyPersistenceLayerError (*args: str | Exception | None)

Unrecoverable error from the data store

Expand source code
class IdempotencyPersistenceLayerError(BaseError):
    """
    Unrecoverable error from the data store
    """

Ancestors

  • BaseError
  • builtins.Exception
  • builtins.BaseException
class IdempotencyValidationError (*args: str | Exception | None)

Payload does not match stored idempotency record

Expand source code
class IdempotencyValidationError(BaseError):
    """
    Payload does not match stored idempotency record
    """

Ancestors

  • BaseError
  • builtins.Exception
  • builtins.BaseException