I am trying to test this decrypt function I copied from another site:
var decrypt = function(mystring, pass, err) {
if (err) return false;
var decipher = crypto.createDecipher('aes-256-cbc', pass)
var dec = decipher.update(mystring,'hex','utf8')
dec += decipher.final('utf8');
return dec;
};
If I enter an invalid encrypted value on purpose, an error is thrown and the NodeJS script stops.
Is it possible to return something like 'error occured'; and keep the script running normally ?