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 <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
tniessen authored and BethGriggs committed Sep 21, 2021
1 parent 9f3a015 commit 6d399e1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions doc/api/crypto.md
Original file line number Diff line number Diff line change
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 6d399e1

Please sign in to comment.