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: nodejs#37594
  • Loading branch information
tniessen committed Aug 30, 2021
1 parent 660b1d1 commit 0b42990
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 @@ -5260,8 +5260,7 @@ const receivedPlaintext = decipher.update(ciphertext, null, 'utf8');
try {
decipher.final();
} catch (err) {
console.error('Authentication failed!');
return;
throw new Error('Authentication failed!');
}

console.log(receivedPlaintext);
Expand Down Expand Up @@ -5305,8 +5304,7 @@ const receivedPlaintext = decipher.update(ciphertext, null, 'utf8');
try {
decipher.final();
} catch (err) {
console.error('Authentication failed!');
return;
throw new Error('Authentication failed!');
}

console.log(receivedPlaintext);
Expand Down

0 comments on commit 0b42990

Please sign in to comment.