doc: fix CCM cipher example in MJS

The original example used 'return' to terminate the current control
flow, which is valid in CommonJS. When the example was copied and
modified to use MJS syntax, the 'return' statement was left in but is
not allowed.

Refs: https://github.com/nodejs/node/pull/37594

PR-URL: https://github.com/nodejs/node/pull/39949
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
Tobias Nießen
2021-08-31 01:01:48 +02:00
committed by Antoine du Hamel
parent a9dd03b1ec
commit 00ca8488aa

View File

@@ -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);