summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2018-09-19 20:04:47 -0700
committerRich Trott <rtrott@gmail.com>2018-09-26 19:36:50 -0700
commitf8d69911bef0ddd150d0f66f7a75b4655cf60b00 (patch)
tree7440234fc5d932a09f276db9f5f2c700fae7591c /doc
parent884dbe9b7f21414b628da43c7016de742ef39454 (diff)
downloadandroid-node-v8-f8d69911bef0ddd150d0f66f7a75b4655cf60b00.tar.gz
android-node-v8-f8d69911bef0ddd150d0f66f7a75b4655cf60b00.tar.bz2
android-node-v8-f8d69911bef0ddd150d0f66f7a75b4655cf60b00.zip
errors: use ERR_OUT_OF_RANGE for index errors
Remove ERR_INDEX_OUT_OF_RANGE in favor of ERR_OUT_OF_RANGE which is capable of providing more detail. (In one instance, use ERR_BUFFER_OUT_OF_BOUNDS which is more accurate in that one instance.) PR-URL: https://github.com/nodejs/node/pull/22969 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/api/buffer.md9
-rw-r--r--doc/api/errors.md13
2 files changed, 14 insertions, 8 deletions
diff --git a/doc/api/buffer.md b/doc/api/buffer.md
index 56999a1955..11f3795741 100644
--- a/doc/api/buffer.md
+++ b/doc/api/buffer.md
@@ -1085,7 +1085,7 @@ console.log(buf1.compare(buf2, 5, 6, 5));
// Prints: 1
```
-[`ERR_INDEX_OUT_OF_RANGE`] is thrown if `targetStart < 0`, `sourceStart < 0`,
+[`ERR_OUT_OF_RANGE`] is thrown if `targetStart < 0`, `sourceStart < 0`,
`targetEnd > target.byteLength`, or `sourceEnd > source.byteLength`.
### buf.copy(target[, targetStart[, sourceStart[, sourceEnd]]])
@@ -1197,6 +1197,9 @@ console.log(buf1.equals(buf3));
<!-- YAML
added: v0.5.0
changes:
+ - version: REPLACEME
+ pr-url: https://github.com/nodejs/node/pull/22969
+ description: Throws `ERR_OUT_OF_RANGE` instead of `ERR_INDEX_OUT_OF_RANGE`.
- version: v10.0.0
pr-url: https://github.com/nodejs/node/pull/18790
description: Negative `end` values throw an `ERR_INDEX_OUT_OF_RANGE` error.
@@ -1708,7 +1711,7 @@ console.log(buf.readIntLE(0, 6).toString(16));
console.log(buf.readIntBE(0, 6).toString(16));
// Prints: 1234567890ab
console.log(buf.readIntBE(1, 6).toString(16));
-// Throws ERR_INDEX_OUT_OF_RANGE
+// Throws ERR_OUT_OF_RANGE
console.log(buf.readIntBE(1, 0).toString(16));
// Throws ERR_OUT_OF_RANGE
```
@@ -2640,9 +2643,9 @@ This value may depend on the JS engine that is being used.
[`Buffer.from(string)`]: #buffer_class_method_buffer_from_string_encoding
[`Buffer.poolSize`]: #buffer_class_property_buffer_poolsize
[`DataView`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView
-[`ERR_INDEX_OUT_OF_RANGE`]: errors.html#ERR_INDEX_OUT_OF_RANGE
[`ERR_INVALID_BUFFER_SIZE`]: errors.html#ERR_INVALID_BUFFER_SIZE
[`ERR_INVALID_OPT_VALUE`]: errors.html#ERR_INVALID_OPT_VALUE
+[`ERR_OUT_OF_RANGE`]: errors.html#ERR_OUT_OF_RANGE
[`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
[`SharedArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer
[`String#indexOf()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf
diff --git a/doc/api/errors.md b/doc/api/errors.md
index ccbf0e5381..f9005c3bb1 100644
--- a/doc/api/errors.md
+++ b/doc/api/errors.md
@@ -1102,11 +1102,6 @@ is set for the `Http2Stream`.
`http2.connect()` was passed a URL that uses any protocol other than `http:` or
`https:`.
-<a id="ERR_INDEX_OUT_OF_RANGE"></a>
-### ERR_INDEX_OUT_OF_RANGE
-
-A given index was out of the accepted range (e.g. negative offsets).
-
<a id="ERR_INSPECTOR_ALREADY_CONNECTED"></a>
### ERR_INSPECTOR_ALREADY_CONNECTED
@@ -1930,6 +1925,14 @@ removed: v10.0.0
Used when an invalid character is found in an HTTP response status message
(reason phrase).
+<a id="ERR_INDEX_OUT_OF_RANGE"></a>
+### ERR_INDEX_OUT_OF_RANGE
+<!-- YAML
+ added: v10.0.0
+ removed: REPLACEME
+-->
+A given index was out of the accepted range (e.g. negative offsets).
+
<a id="ERR_NAPI_CONS_PROTOTYPE_OBJECT"></a>
### ERR_NAPI_CONS_PROTOTYPE_OBJECT
<!-- YAML