mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
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:
committed by
Antoine du Hamel
parent
a9dd03b1ec
commit
00ca8488aa
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user