mirror of https://github.com/grpc/grpc-node.git
Merge pull request #143 from murgatroid99/server_shutdown_callback_error
Add JS error for missing callback to sever#tryShutdown
This commit is contained in:
commit
ea12033eff
packages/grpc-native-core/ext
|
@ -312,6 +312,9 @@ NAN_METHOD(Server::TryShutdown) {
|
||||||
if (!HasInstance(info.This())) {
|
if (!HasInstance(info.This())) {
|
||||||
return Nan::ThrowTypeError("tryShutdown can only be called on a Server");
|
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());
|
Server *server = ObjectWrap::Unwrap<Server>(info.This());
|
||||||
if (server->wrapped_server == NULL) {
|
if (server->wrapped_server == NULL) {
|
||||||
// Server is already shut down. Call callback immediately.
|
// Server is already shut down. Call callback immediately.
|
||||||
|
|
Loading…
Reference in New Issue