diff options
author | Tobias Nießen <tniessen@tnie.de> | 2021-08-31 02:01:48 +0300 |
---|---|---|
committer | Antoine du Hamel <duhamelantoine1995@gmail.com> | 2021-09-10 19:07:32 +0300 |
commit | 00ca8488aafe374306bd98030cbe9aff5e309fa4 (patch) | |
tree | 37951919fd9c592d00fdc2be909507143cdc411a /doc | |
parent | a9dd03b1ec89a75186f05967fc76ec0704050c36 (diff) |
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: https://github.com/nodejs/node/pull/37594
PR-URL: https://github.com/nodejs/node/pull/39949
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/crypto.md | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 45f31a00384..00bdfbc6fdc 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -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); @@ -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); |