in AwsCryptographicMaterialProviders/runtimes/go/TestsFromDafny-go/awscryptographymaterialproviderssmithygenerated/to_dafny.go [620:696]
func Error_ToDafny(err error) AwsCryptographyMaterialProvidersTypes.Error {
switch err.(type) {
// Service Errors
case awscryptographymaterialproviderssmithygeneratedtypes.AwsCryptographicMaterialProvidersException:
return AwsCryptographicMaterialProvidersException_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.AwsCryptographicMaterialProvidersException))
case awscryptographymaterialproviderssmithygeneratedtypes.EntryAlreadyExists:
return EntryAlreadyExists_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.EntryAlreadyExists))
case awscryptographymaterialproviderssmithygeneratedtypes.EntryDoesNotExist:
return EntryDoesNotExist_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.EntryDoesNotExist))
case awscryptographymaterialproviderssmithygeneratedtypes.InFlightTTLExceeded:
return InFlightTTLExceeded_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.InFlightTTLExceeded))
case awscryptographymaterialproviderssmithygeneratedtypes.InvalidAlgorithmSuiteInfo:
return InvalidAlgorithmSuiteInfo_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.InvalidAlgorithmSuiteInfo))
case awscryptographymaterialproviderssmithygeneratedtypes.InvalidAlgorithmSuiteInfoOnDecrypt:
return InvalidAlgorithmSuiteInfoOnDecrypt_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.InvalidAlgorithmSuiteInfoOnDecrypt))
case awscryptographymaterialproviderssmithygeneratedtypes.InvalidAlgorithmSuiteInfoOnEncrypt:
return InvalidAlgorithmSuiteInfoOnEncrypt_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.InvalidAlgorithmSuiteInfoOnEncrypt))
case awscryptographymaterialproviderssmithygeneratedtypes.InvalidDecryptionMaterials:
return InvalidDecryptionMaterials_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.InvalidDecryptionMaterials))
case awscryptographymaterialproviderssmithygeneratedtypes.InvalidDecryptionMaterialsTransition:
return InvalidDecryptionMaterialsTransition_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.InvalidDecryptionMaterialsTransition))
case awscryptographymaterialproviderssmithygeneratedtypes.InvalidEncryptionMaterials:
return InvalidEncryptionMaterials_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.InvalidEncryptionMaterials))
case awscryptographymaterialproviderssmithygeneratedtypes.InvalidEncryptionMaterialsTransition:
return InvalidEncryptionMaterialsTransition_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.InvalidEncryptionMaterialsTransition))
//DependentErrors
case awscryptographyprimitivessmithygeneratedtypes.AwsCryptographicPrimitivesBaseException:
return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(awscryptographyprimitivessmithygenerated.Error_ToDafny(err))
case awscryptographykeystoresmithygeneratedtypes.KeyStoreBaseException:
return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyKeyStore_(awscryptographykeystoresmithygenerated.Error_ToDafny(err))
case *smithy.OperationError:
if err.(*smithy.OperationError).Service() == "DynamoDB" {
DynamoDBError := comamazonawsdynamodbsmithygenerated.Error_ToDafny(err)
return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_ComAmazonawsDynamodb_(DynamoDBError)
}
if err.(*smithy.OperationError).Service() == "KMS" {
KMSError := comamazonawskmssmithygenerated.Error_ToDafny(err)
return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_ComAmazonawsKms_(KMSError)
}
return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_Opaque_(err)
case smithy.APIError:
DynamoDBError := comamazonawsdynamodbsmithygenerated.Error_ToDafny(err)
if !DynamoDBError.Is_OpaqueWithText() {
return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_ComAmazonawsDynamodb_(DynamoDBError)
}
KMSError := comamazonawskmssmithygenerated.Error_ToDafny(err)
if !KMSError.Is_OpaqueWithText() {
return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_ComAmazonawsKms_(KMSError)
}
return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_Opaque_(err)
//Unmodelled Errors
case awscryptographymaterialproviderssmithygeneratedtypes.CollectionOfErrors:
return CollectionOfErrors_Input_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.CollectionOfErrors))
default:
error, ok := err.(awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError)
if !ok {
panic("Error is not an OpaqueError")
}
return OpaqueError_Input_ToDafny(error)
}
}