Skip to content

Commit

Permalink
buffer: fix not return on error
Browse files Browse the repository at this point in the history
Throwing a JS error from C++ does not mean the function will return
early. This must be done manually.

Also remove extraneous comment no longer relevant.

Fix: 2903030 "buffer: switch API to return MaybeLocal<T>"
PR-URL: #2225
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
trevnorris authored and rvagg committed Aug 4, 2015
1 parent 6c97138 commit 8d13222
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/node_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ MaybeLocal<Object> Copy(Isolate* isolate, const char* data, size_t length) {
}


// Make a copy of "data". Why this isn't called "Copy", we'll never know.
MaybeLocal<Object> New(Environment* env, const char* data, size_t length) {
EscapableHandleScope scope(env->isolate());

Expand Down Expand Up @@ -474,7 +473,7 @@ void Slice(const FunctionCallbackInfo<Value>& args) {
Maybe<bool> mb =
ui->SetPrototype(env->context(), env->buffer_prototype_object());
if (!mb.FromMaybe(false))
env->ThrowError("Unable to set Object prototype");
return env->ThrowError("Unable to set Object prototype");
args.GetReturnValue().Set(ui);
}

Expand Down

0 comments on commit 8d13222

Please sign in to comment.