in AwsEncryptionSDK/runtimes/python/src/aws_encryption_sdk_dafny/smithygenerated/aws_cryptography_encryptionsdk/errors.py [0:0]
def _smithy_error_to_dafny_error(e: ServiceError):
"""Converts the provided native Smithy-modeled error into the corresponding
Dafny error."""
if isinstance(
e,
aws_encryption_sdk_dafny.smithygenerated.aws_cryptography_encryptionsdk.errors.AwsEncryptionSdkException,
):
return aws_encryption_sdk_dafny.internaldafny.generated.AwsCryptographyEncryptionSdkTypes.Error_AwsEncryptionSdkException(
message=_dafny.Seq(e.message)
)
if isinstance(e, AwsCryptographicPrimitives):
return aws_encryption_sdk_dafny.internaldafny.generated.AwsCryptographyEncryptionSdkTypes.Error_AwsCryptographyPrimitives(
aws_cryptography_primitives_smithy_error_to_dafny_error(e.message)
)
if isinstance(e, AwsCryptographicMaterialProviders):
return aws_encryption_sdk_dafny.internaldafny.generated.AwsCryptographyEncryptionSdkTypes.Error_AwsCryptographyMaterialProviders(
aws_cryptography_materialproviders_smithy_error_to_dafny_error(e.message)
)
if isinstance(e, CollectionOfErrors):
return aws_encryption_sdk_dafny.internaldafny.generated.AwsCryptographyEncryptionSdkTypes.Error_CollectionOfErrors(
message=_dafny.Seq(e.message),
list=_dafny.Seq(
_smithy_error_to_dafny_error(native_err) for native_err in e.list
),
)
if isinstance(e, OpaqueError):
return aws_encryption_sdk_dafny.internaldafny.generated.AwsCryptographyEncryptionSdkTypes.Error_Opaque(
obj=e.obj
)
if isinstance(e, OpaqueWithTextError):
return aws_encryption_sdk_dafny.internaldafny.generated.AwsCryptographyEncryptionSdkTypes.Error_OpaqueWithText(
obj=e.obj, objMessage=e.obj_message
)
else:
return aws_encryption_sdk_dafny.internaldafny.generated.AwsCryptographyEncryptionSdkTypes.Error_Opaque(
obj=e
)