diff options
author | 2015-10-12 16:12:04 -0700 | |
---|---|---|
committer | 2015-10-12 16:12:04 -0700 | |
commit | 75a2bbaab2ed7c06c7655c69b00bb89a5c2d3448 (patch) | |
tree | 780f76d84adb714078f9ceb45880b3b60b17abe0 /src/node/ext/server_credentials.cc | |
parent | 6fe015e492ef41f533ac3441882c437a7560b977 (diff) |
Refactored some C++ code to improve code reuse
Diffstat (limited to 'src/node/ext/server_credentials.cc')
-rw-r--r-- | src/node/ext/server_credentials.cc | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/node/ext/server_credentials.cc b/src/node/ext/server_credentials.cc index 5e922bd877..e6c55e263c 100644 --- a/src/node/ext/server_credentials.cc +++ b/src/node/ext/server_credentials.cc @@ -117,7 +117,7 @@ NAN_METHOD(ServerCredentials::New) { if (info.IsConstructCall()) { if (!info[0]->IsExternal()) { return Nan::ThrowTypeError( - "ServerCredentials can only be created with the provide functions"); + "ServerCredentials can only be created with the provided functions"); } Local<External> ext = info[0].As<External>(); grpc_server_credentials *creds_value = @@ -126,16 +126,9 @@ NAN_METHOD(ServerCredentials::New) { credentials->Wrap(info.This()); info.GetReturnValue().Set(info.This()); } else { - const int argc = 1; - Local<Value> argv[argc] = {info[0]}; - MaybeLocal<Object> maybe_instance = constructor->GetFunction()->NewInstance( - argc, argv); - if (maybe_instance.IsEmpty()) { - // There's probably a pending exception - return; - } else { - info.GetReturnValue().Set(maybe_instance.ToLocalChecked()); - } + // This should never be called directly + return Nan::ThrowTypeError( + "ServerCredentials can only be created with the provided functions"); } } |