func Error_ToDafny()

in releases/go/encryption-sdk/awscryptographyencryptionsdksmithygenerated/to_dafny.go [99:123]


func Error_ToDafny(err error) AwsCryptographyEncryptionSdkTypes.Error {
	switch err.(type) {
	// Service Errors
	case awscryptographyencryptionsdksmithygeneratedtypes.AwsEncryptionSdkException:
		return AwsEncryptionSdkException_ToDafny(err.(awscryptographyencryptionsdksmithygeneratedtypes.AwsEncryptionSdkException))

	//DependentErrors
	case awscryptographyprimitivessmithygeneratedtypes.AwsCryptographicPrimitivesBaseException:
		return AwsCryptographyEncryptionSdkTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(awscryptographyprimitivessmithygenerated.Error_ToDafny(err))

	case awscryptographymaterialproviderssmithygeneratedtypes.AwsCryptographicMaterialProvidersBaseException:
		return AwsCryptographyEncryptionSdkTypes.Companion_Error_.Create_AwsCryptographyMaterialProviders_(awscryptographymaterialproviderssmithygenerated.Error_ToDafny(err))

	//Unmodelled Errors
	case awscryptographyencryptionsdksmithygeneratedtypes.CollectionOfErrors:
		return CollectionOfErrors_Input_ToDafny(err.(awscryptographyencryptionsdksmithygeneratedtypes.CollectionOfErrors))

	default:
		error, ok := err.(awscryptographyencryptionsdksmithygeneratedtypes.OpaqueError)
		if !ok {
			panic("Error is not an OpaqueError")
		}
		return OpaqueError_Input_ToDafny(error)
	}
}