Module aws_lambda_powertools.utilities.idempotency.exceptions

Idempotency errors

Classes

class BaseError (*args: Union[str, Exception, ForwardRef(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: Optional[Union[str, Exception]]):
        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: Union[str, Exception, ForwardRef(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: Union[str, Exception, ForwardRef(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: Union[str, Exception, ForwardRef(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: Union[str, Exception, ForwardRef(None)], old_data_record: Optional[DataRecord] = 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: Optional[Union[str, Exception]], old_data_record: Optional[DataRecord] = 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: Union[str, Exception, ForwardRef(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: Union[str, Exception, ForwardRef(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: Union[str, Exception, ForwardRef(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: Union[str, Exception, ForwardRef(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: Union[str, Exception, ForwardRef(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: Union[str, Exception, ForwardRef(None)])

Idempotency persistence connection error

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

Ancestors

  • BaseError
  • builtins.Exception
  • builtins.BaseException
class IdempotencyPersistenceConsistencyError (*args: Union[str, Exception, ForwardRef(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: Union[str, Exception, ForwardRef(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: Union[str, Exception, ForwardRef(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