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 aduh95 committed Sep 10, 2021
1 parent a9dd03b commit 00ca848
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 @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 00ca848

Please sign in to comment.