mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
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>
This commit is contained in:
1 parent
884dbe9b7f
commit
f8d69911be
9 files changed
+104
-85
No files matched your search
+8
-2
@@ -26,7 +26,6 @@ namespace node {
|
||||
V(ERR_CANNOT_TRANSFER_OBJECT, TypeError) \
|
||||
V(ERR_CLOSED_MESSAGE_PORT, Error) \
|
||||
V(ERR_CONSTRUCT_CALL_REQUIRED, Error) \
|
||||
V(ERR_INDEX_OUT_OF_RANGE, RangeError) \
|
||||
V(ERR_INVALID_ARG_VALUE, TypeError) \
|
||||
V(ERR_INVALID_ARG_TYPE, TypeError) \
|
||||
V(ERR_INVALID_TRANSFER_OBJECT, TypeError) \
|
||||
@@ -35,6 +34,7 @@ namespace node {
|
||||
V(ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST, TypeError) \
|
||||
V(ERR_MISSING_MODULE, Error) \
|
||||
V(ERR_MISSING_PLATFORM_FOR_WORKER, Error) \
|
||||
V(ERR_OUT_OF_RANGE, RangeError) \
|
||||
V(ERR_SCRIPT_EXECUTION_INTERRUPTED, Error) \
|
||||
V(ERR_SCRIPT_EXECUTION_TIMEOUT, Error) \
|
||||
V(ERR_STRING_TOO_LONG, Error) \
|
||||
@@ -64,7 +64,6 @@ namespace node {
|
||||
V(ERR_CANNOT_TRANSFER_OBJECT, "Cannot transfer object of unsupported type")\
|
||||
V(ERR_CLOSED_MESSAGE_PORT, "Cannot send data on closed MessagePort") \
|
||||
V(ERR_CONSTRUCT_CALL_REQUIRED, "Cannot call constructor without `new`") \
|
||||
V(ERR_INDEX_OUT_OF_RANGE, "Index out of range") \
|
||||
V(ERR_INVALID_TRANSFER_OBJECT, "Found invalid object in transferList") \
|
||||
V(ERR_MEMORY_ALLOCATION_FAILED, "Failed to allocate memory") \
|
||||
V(ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST, \
|
||||
@@ -96,6 +95,13 @@ inline void THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(Environment* env,
|
||||
THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(env, message.str().c_str());
|
||||
}
|
||||
|
||||
inline void THROW_ERR_OUT_OF_RANGE_WITH_TEXT(Environment* env,
|
||||
const char* messageText) {
|
||||
std::ostringstream message;
|
||||
message << messageText;
|
||||
THROW_ERR_OUT_OF_RANGE(env, message.str().c_str());
|
||||
}
|
||||
|
||||
inline v8::Local<v8::Value> ERR_BUFFER_TOO_LARGE(v8::Isolate* isolate) {
|
||||
char message[128];
|
||||
snprintf(message, sizeof(message),
|
||||
|
||||
Reference in new issue
Block a user