Skip to content

Commit ea12033

Browse files
authored
Merge pull request #143 from murgatroid99/server_shutdown_callback_error
Add JS error for missing callback to sever#tryShutdown
2 parents 31b75d7 + 843d063 commit ea12033

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/grpc-native-core/ext/server.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,9 @@ NAN_METHOD(Server::TryShutdown) {
312312
if (!HasInstance(info.This())) {
313313
return Nan::ThrowTypeError("tryShutdown can only be called on a Server");
314314
}
315+
if (!info[0]->IsFunction()) {
316+
return Nan::ThrowError("tryShutdown's argument must be a callback");
317+
}
315318
Server *server = ObjectWrap::Unwrap<Server>(info.This());
316319
if (server->wrapped_server == NULL) {
317320
// Server is already shut down. Call callback immediately.

0 commit comments

Comments
 (0)