diff --git a/doc/api/buffer.md b/doc/api/buffer.md index e0f2e812f32..b971021416a 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -442,9 +442,9 @@ changes: * `size` {integer} The desired length of the new `Buffer`. -Allocates a new `Buffer` of `size` bytes. If the `size` is larger than -[`buffer.constants.MAX_LENGTH`] or smaller than 0, a [`RangeError`] will be -thrown. A zero-length `Buffer` will be created if `size` is 0. +Allocates a new `Buffer` of `size` bytes. If `size` is larger than +[`buffer.constants.MAX_LENGTH`] or smaller than 0, [`ERR_INVALID_OPT_VALUE`] is +thrown. A zero-length `Buffer` is created if `size` is 0. Prior to Node.js 8.0.0, the underlying memory for `Buffer` instances created in this way is *not initialized*. The contents of a newly created @@ -530,9 +530,9 @@ console.log(buf); // Prints: ``` -Allocates a new `Buffer` of `size` bytes. If the `size` is larger than -[`buffer.constants.MAX_LENGTH`] or smaller than 0, a [`RangeError`] will be -thrown. A zero-length `Buffer` will be created if `size` is 0. +Allocates a new `Buffer` of `size` bytes. If `size` is larger than +[`buffer.constants.MAX_LENGTH`] or smaller than 0, [`ERR_INVALID_OPT_VALUE`] is +thrown. A zero-length `Buffer` is created if `size` is 0. If `fill` is specified, the allocated `Buffer` will be initialized by calling [`buf.fill(fill)`][`buf.fill()`]. @@ -571,9 +571,9 @@ changes: * `size` {integer} The desired length of the new `Buffer`. -Allocates a new `Buffer` of `size` bytes. If the `size` is larger than -[`buffer.constants.MAX_LENGTH`] or smaller than 0, a [`RangeError`] will be -thrown. A zero-length `Buffer` will be created if `size` is 0. +Allocates a new `Buffer` of `size` bytes. If `size` is larger than +[`buffer.constants.MAX_LENGTH`] or smaller than 0, [`ERR_INVALID_OPT_VALUE`] is +thrown. A zero-length `Buffer` is created if `size` is 0. The underlying memory for `Buffer` instances created in this way is *not initialized*. The contents of the newly created `Buffer` are unknown and @@ -615,9 +615,9 @@ added: v5.12.0 * `size` {integer} The desired length of the new `Buffer`. -Allocates a new `Buffer` of `size` bytes. If the `size` is larger than -[`buffer.constants.MAX_LENGTH`] or smaller than 0, a [`RangeError`] will be -thrown. A zero-length `Buffer` will be created if `size` is 0. +Allocates a new `Buffer` of `size` bytes. If `size` is larger than +[`buffer.constants.MAX_LENGTH`] or smaller than 0, [`ERR_INVALID_OPT_VALUE`] is +thrown. A zero-length `Buffer` is created if `size` is 0. The underlying memory for `Buffer` instances created in this way is *not initialized*. The contents of the newly created `Buffer` are unknown and @@ -1058,8 +1058,8 @@ console.log(buf1.compare(buf2, 5, 6, 5)); // Prints: 1 ``` -A `RangeError` will be thrown if: `targetStart < 0`, `sourceStart < 0`, -`targetEnd > target.byteLength` or `sourceEnd > source.byteLength`. +[`ERR_INDEX_OUT_OF_RANGE`] is thrown if `targetStart < 0`, `sourceStart < 0`, +`targetEnd > target.byteLength`, or `sourceEnd > source.byteLength`. ### buf.copy(target[, targetStart[, sourceStart[, sourceEnd]]])