diff --git a/src/aiodynamo/errors.py b/src/aiodynamo/errors.py index 60eb43d..e44f203 100644 --- a/src/aiodynamo/errors.py +++ b/src/aiodynamo/errors.py @@ -1,6 +1,6 @@ import json from dataclasses import dataclass -from typing import Any, Dict, List, Union +from typing import Any, Dict, Optional, List @dataclass(frozen=True) @@ -117,11 +117,11 @@ class PointInTimeRecoveryUnavailable(AIODynamoError): class TransactionCanceled(AIODynamoError): - cancellation_reasons: List[Union[CancellationReason, None]] + cancellation_reasons: List[Optional[CancellationReason]] def __init__(self, body: Dict[str, Any]): self.body = body - self.cancellation_reasons: List[CancellationReason] = [ + self.cancellation_reasons: List[Optional[CancellationReason]] = [ CancellationReason(reason["Code"], reason["Message"]) if reason["Code"] != "None" else None