Catching exception caused by using the wrong key to decrypt the profile.
This commit is contained in:
parent
074e691cf9
commit
fb88b05463
1 changed files with 9 additions and 1 deletions
|
|
@ -124,7 +124,15 @@
|
||||||
return;
|
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);
|
cb(null, decrypted);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue