diff options
| author | Anna Henningsen <anna@addaleax.net> | 2018-10-25 19:35:17 +0200 |
|---|---|---|
| committer | Michaël Zasso <targos@protonmail.com> | 2018-10-28 15:05:10 +0100 |
| commit | 0fd55e71fe376458d1d82503a643114db8675208 (patch) | |
| tree | a7c0b27d5a6d61b65d080ace4f46cdcabf9c37ed /src/node_buffer.cc | |
| parent | b1e1fe4e07e24fcafa278b498291620dd61411ab (diff) | |
| download | node-new-0fd55e71fe376458d1d82503a643114db8675208.tar.gz | |
src: minor refactor to node_errors.h
Add overloads of the error generation/throwing methods
that take an `Isolate*` argument, since the created objects
don’t depend on the `Environment*` in question.
Also, remove `THROW_ERR_OUT_OF_RANGE_WITH_TEXT`, which did the
same thing as `THROW_ERR_OUT_OF_RANGE` in a more convoluted way.
PR-URL: https://github.com/nodejs/node/pull/23879
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Diffstat (limited to 'src/node_buffer.cc')
| -rw-r--r-- | src/node_buffer.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 19841336e9..d4f7c75163 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -41,8 +41,7 @@ #define THROW_AND_RETURN_IF_OOB(r) \ do { \ if (!(r)) \ - return node::THROW_ERR_OUT_OF_RANGE_WITH_TEXT(env, \ - "Index out of range"); \ + return node::THROW_ERR_OUT_OF_RANGE(env, "Index out of range"); \ } while (0) \ #define SLICE_START_END(start_arg, end_arg, end_max) \ @@ -494,7 +493,7 @@ void Copy(const FunctionCallbackInfo<Value> &args) { return args.GetReturnValue().Set(0); if (source_start > ts_obj_length) - return node::THROW_ERR_OUT_OF_RANGE_WITH_TEXT( + return THROW_ERR_OUT_OF_RANGE( env, "The value of \"sourceStart\" is out of range."); if (source_end - source_start > target_length - target_start) @@ -685,10 +684,10 @@ void CompareOffset(const FunctionCallbackInfo<Value> &args) { THROW_AND_RETURN_IF_OOB(ParseArrayIndex(args[5], ts_obj_length, &source_end)); if (source_start > ts_obj_length) - return node::THROW_ERR_OUT_OF_RANGE_WITH_TEXT( + return THROW_ERR_OUT_OF_RANGE( env, "The value of \"sourceStart\" is out of range."); if (target_start > target_length) - return node::THROW_ERR_OUT_OF_RANGE_WITH_TEXT( + return THROW_ERR_OUT_OF_RANGE( env, "The value of \"targetStart\" is out of range."); CHECK_LE(source_start, source_end); |
