Skip to content

Commit 00ca848

Browse files
tniessenaduh95
authored andcommitted
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: #37594 PR-URL: #39949 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
1 parent a9dd03b commit 00ca848

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

doc/api/crypto.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5285,8 +5285,7 @@ const receivedPlaintext = decipher.update(ciphertext, null, 'utf8');
52855285
try {
52865286
decipher.final();
52875287
} catch (err) {
5288-
console.error('Authentication failed!');
5289-
return;
5288+
throw new Error('Authentication failed!', { cause: err });
52905289
}
52915290

52925291
console.log(receivedPlaintext);
@@ -5330,8 +5329,7 @@ const receivedPlaintext = decipher.update(ciphertext, null, 'utf8');
53305329
try {
53315330
decipher.final();
53325331
} catch (err) {
5333-
console.error('Authentication failed!');
5334-
return;
5332+
throw new Error('Authentication failed!', { cause: err });
53355333
}
53365334

53375335
console.log(receivedPlaintext);

0 commit comments

Comments
 (0)