Reputation: 31
crypto.randomBytes(48, function (err, buffer) {
if (err) {
x = false;
return;
}
I need to create a test code where err is true. How to let crypto.randomByte cause an error.
Upvotes: 2
Views: 645
Reputation: 2822
There will be an error if you provide an invalid value. e.g.
crypto.randomBytes(-1)
Upvotes: 1