Skip to content
This repository was archived by the owner on May 9, 2020. It is now read-only.

Commit e2cf2c1

Browse files
committed
Add error messages for decryption exceptions
1 parent 08e00ec commit e2cf2c1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

chef/encrypted_data_bag_item.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def decrypt(self):
116116
try:
117117
value = json.loads(value)
118118
except ValueError:
119-
raise ChefDecryptionError()
119+
raise ChefDecryptionError("Error decrypting data bag value. Most likely the provided key is incorrect")
120120
return value['json_wrapper']
121121

122122
class DecryptorVersion2(DecryptorVersion1):
@@ -139,5 +139,5 @@ def decrypt(self):
139139
if self._validate_hmac():
140140
return super(EncryptedDataBagItem.Decryptors.DecryptorVersion2, self).decrypt()
141141
else:
142-
raise ChefDecryptionError()
142+
raise ChefDecryptionError("Error decrypting data bag value. HMAC validation failed.")
143143

0 commit comments

Comments
 (0)