Skip to content

Commit a8565ce

Browse files
using a more descriptive message
1 parent bd4d269 commit a8565ce

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/authentication/util/MLEUtility.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,12 @@ exports.checkAndDecryptEncryptedResponse = function (responseBody, merchantConfi
9393
return JSON.parse(decryptedData);
9494
})
9595
.catch(error => {
96-
const errorMsg = `Error decrypting MLE response: ${error.message}`;
96+
let errorMsg;
97+
if (error.message.includes('no key found') || error.message.includes('key not found')) {
98+
errorMsg = 'Decryption failed: unable to find a suitable decryption key.';
99+
} else {
100+
errorMsg = `Error decrypting MLE response: ${error.message}`;
101+
}
97102
logger.error(errorMsg);
98103
// Create a more descriptive error
99104
return Promise.reject(new Error(errorMsg));

0 commit comments

Comments
 (0)