From 843d0630377d4e29d0d14304035a4b044259fb4e Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 5 Jan 2018 13:09:15 -0800 Subject: [PATCH] Add JS error for missing callback to sever#tryShutdown --- packages/grpc-native-core/ext/server.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/grpc-native-core/ext/server.cc b/packages/grpc-native-core/ext/server.cc index c6ab5e189..d5b4763b3 100644 --- a/packages/grpc-native-core/ext/server.cc +++ b/packages/grpc-native-core/ext/server.cc @@ -312,6 +312,9 @@ NAN_METHOD(Server::TryShutdown) { if (!HasInstance(info.This())) { return Nan::ThrowTypeError("tryShutdown can only be called on a Server"); } + if (!info[0]->IsFunction()) { + return Nan::ThrowError("tryShutdown's argument must be a callback"); + } Server *server = ObjectWrap::Unwrap(info.This()); if (server->wrapped_server == NULL) { // Server is already shut down. Call callback immediately.