Skip to content

Commit

Permalink
Merge pull request #143 from murgatroid99/server_shutdown_callback_error
Browse files Browse the repository at this point in the history
Add JS error for missing callback to sever#tryShutdown
  • Loading branch information
murgatroid99 authored Jan 9, 2018
2 parents 31b75d7 + 843d063 commit ea12033
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/grpc-native-core/ext/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<Server>(info.This());
if (server->wrapped_server == NULL) {
// Server is already shut down. Call callback immediately.
Expand Down

0 comments on commit ea12033

Please sign in to comment.