From 87fd4661b45827c5c31280b3c3c75f31959d1687 Mon Sep 17 00:00:00 2001 From: Volker Mische Date: Fri, 19 Jan 2018 15:45:22 +0100 Subject: [PATCH] Error message on Buffer creation changed --- index.js | 2 +- test/node/test-buffer-alloc.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 63479f4..01977be 100644 --- a/index.js +++ b/index.js @@ -264,7 +264,7 @@ function fromObject (obj) { } } - throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.') + throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object.') } function checked (length) { diff --git a/test/node/test-buffer-alloc.js b/test/node/test-buffer-alloc.js index 3f04b3e..0bd87a3 100644 --- a/test/node/test-buffer-alloc.js +++ b/test/node/test-buffer-alloc.js @@ -939,14 +939,14 @@ Buffer.poolSize = ps; // Test Buffer.copy() segfault assert.throws(() => Buffer.allocUnsafe(10).copy(), /TypeError: argument should be a Buffer/); -/* + var regErrorMsg = new RegExp('The first argument must be one of type string, Buffer, ' + 'ArrayBuffer, Array, or Array-like Object\\.'); assert.throws(() => Buffer.from(), regErrorMsg); assert.throws(() => Buffer.from(null), regErrorMsg); -*/ + // Test prototype getters don't throw assert.strictEqual(Buffer.prototype.parent, undefined); assert.strictEqual(Buffer.prototype.offset, undefined); -- 2.34.1