Catching exception caused by using the wrong key to decrypt the profile.

This commit is contained in:
Brendon Duncan 2018-06-28 21:55:06 +12:00
commit fb88b05463

View file

@ -124,7 +124,15 @@
return;
}
var decrypted = _decryptUsingCryptoJS(str, key, opts.iv);
var decrypted;
try {
decrypted = _decryptUsingCryptoJS(str, key, opts.iv);
} catch (e) {
// Can get this when using the wrong key: Malformed UTF-8 data
$log.error('Error when decrypting.', e);
cb(e, null);
return;
}
cb(null, decrypted);
});
};