File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -668,8 +668,10 @@ void StringWrite(const FunctionCallbackInfo<Value>& args) {
668
668
size_t max_length;
669
669
670
670
THROW_AND_RETURN_IF_OOB (ParseArrayIndex (args[1 ], 0 , &offset));
671
- if (offset > ts_obj_length)
672
- return env->ThrowRangeError (" Offset is out of bounds" );
671
+ if (offset > ts_obj_length) {
672
+ return node::THROW_ERR_BUFFER_OUT_OF_BOUNDS (
673
+ env, " \" offset\" is outside of buffer bounds" );
674
+ }
673
675
674
676
THROW_AND_RETURN_IF_OOB (ParseArrayIndex (args[2 ], ts_obj_length - offset,
675
677
&max_length));
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ namespace node {
17
17
// a `Local<Value>` containing the TypeError with proper code and message
18
18
19
19
#define ERRORS_WITH_CODE (V ) \
20
+ V (ERR_BUFFER_OUT_OF_BOUNDS, RangeError) \
20
21
V (ERR_INDEX_OUT_OF_RANGE, RangeError) \
21
22
V (ERR_INVALID_ARG_TYPE, TypeError) \
22
23
V (ERR_MEMORY_ALLOCATION_FAILED, Error) \
You can’t perform that action at this time.
0 commit comments