diff --git a/AwsCryptographicMaterialProviders/dafny/AwsCryptographicMaterialProviders/src/Keyrings/AwsKms/AwsKmsHierarchicalKeyring.dfy b/AwsCryptographicMaterialProviders/dafny/AwsCryptographicMaterialProviders/src/Keyrings/AwsKms/AwsKmsHierarchicalKeyring.dfy index 7e335270b..aee48dd72 100644 --- a/AwsCryptographicMaterialProviders/dafny/AwsCryptographicMaterialProviders/src/Keyrings/AwsKms/AwsKmsHierarchicalKeyring.dfy +++ b/AwsCryptographicMaterialProviders/dafny/AwsCryptographicMaterialProviders/src/Keyrings/AwsKms/AwsKmsHierarchicalKeyring.dfy @@ -482,6 +482,11 @@ module AwsKmsHierarchicalKeyring { verifyValidStateCache(cache); var getCacheOutput := getEntry(cache, getCacheInput); + // If error is not EntryDoesNotExist, return Failure + if (getCacheOutput.Failure? && !getCacheOutput.error.EntryDoesNotExist?) { + return Failure(getCacheOutput.error); + } + var now := Time.GetCurrent(); // //= aws-encryption-sdk-specification/framework/aws-kms/aws-kms-hierarchical-keyring.md#onencrypt @@ -864,6 +869,11 @@ module AwsKmsHierarchicalKeyring { verifyValidStateCache(cache); var getCacheOutput := getEntry(cache, getCacheInput); + // If error is not EntryDoesNotExist, return Failure + if (getCacheOutput.Failure? && !getCacheOutput.error.EntryDoesNotExist?) { + return Failure(getCacheOutput.error); + } + var now := Time.GetCurrent(); // //= aws-encryption-sdk-specification/framework/aws-kms/aws-kms-hierarchical-keyring.md#ondecrypt