diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 45f31a00384..00bdfbc6fdc 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -5285,8 +5285,7 @@ const receivedPlaintext = decipher.update(ciphertext, null, 'utf8'); try { decipher.final(); } catch (err) { - console.error('Authentication failed!'); - return; + throw new Error('Authentication failed!', { cause: err }); } console.log(receivedPlaintext); @@ -5330,8 +5329,7 @@ const receivedPlaintext = decipher.update(ciphertext, null, 'utf8'); try { decipher.final(); } catch (err) { - console.error('Authentication failed!'); - return; + throw new Error('Authentication failed!', { cause: err }); } console.log(receivedPlaintext);