Skip to content

Commit

Permalink
doc: fix CCM cipher example in MJS
Browse files Browse the repository at this point in the history
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: #37594

PR-URL: #39949
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
tniessen authored and BethGriggs committed Sep 21, 2021
1 parent b102e07 commit 4bc6f79
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions doc/api/crypto.md
Expand Up @@ -5283,8 +5283,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);
Expand Down Expand Up @@ -5328,8 +5327,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);
Expand Down

0 comments on commit 4bc6f79

Please sign in to comment.