From d32363ff2049a5d6f53d3e9ce7255c474838a6d5 Mon Sep 17 00:00:00 2001 From: Minwoo Jung Date: Sun, 27 Sep 2015 17:20:27 +0900 Subject: [PATCH] doc: fix outdated 'try/catch' statement in sync Fixes description about crypto.randomBytes. Fixes: https://github.com/nodejs/node/issues/3081 PR-URL: https://github.com/nodejs/node/pull/3087 Reviewed-By: Ben Noordhuis Reviewed-By: Brendan Ashworth Reviewed-By: Sakthipriyan Vairamani --- doc/api/crypto.markdown | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/doc/api/crypto.markdown b/doc/api/crypto.markdown index 093b600871e34c..0379179de3593c 100644 --- a/doc/api/crypto.markdown +++ b/doc/api/crypto.markdown @@ -651,13 +651,8 @@ Generates cryptographically strong pseudo-random data. Usage: }); // sync - try { - var buf = crypto.randomBytes(256); - console.log('Have %d bytes of random data: %s', buf.length, buf); - } catch (ex) { - // handle error - // most likely, entropy sources are drained - } + const buf = crypto.randomBytes(256); + console.log('Have %d bytes of random data: %s', buf.length, buf); NOTE: This will block if there is insufficient entropy, although it should normally never take longer than a few milliseconds. The only time when this