Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f92aee7

Browse filesBrowse files
JungMinurvagg
authored andcommitted
doc: fix outdated 'try/catch' statement in sync
Fixes description about crypto.randomBytes. Fixes: #3081 PR-URL: #3087 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
1 parent 5a9e795 commit f92aee7
Copy full SHA for f92aee7

File tree

Expand file treeCollapse file tree

1 file changed

+2
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-7
lines changed
Open diff view settings
Collapse file

‎doc/api/crypto.markdown‎

Copy file name to clipboardExpand all lines: doc/api/crypto.markdown
+2-7Lines changed: 2 additions & 7 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -651,13 +651,8 @@ Generates cryptographically strong pseudo-random data. Usage:
651651
});
652652

653653
// sync
654-
try {
655-
var buf = crypto.randomBytes(256);
656-
console.log('Have %d bytes of random data: %s', buf.length, buf);
657-
} catch (ex) {
658-
// handle error
659-
// most likely, entropy sources are drained
660-
}
654+
const buf = crypto.randomBytes(256);
655+
console.log('Have %d bytes of random data: %s', buf.length, buf);
661656

662657
NOTE: This will block if there is insufficient entropy, although it should
663658
normally never take longer than a few milliseconds. The only time when this

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.