aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/node/ext/call.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/node/ext/call.cc')
-rw-r--r--src/node/ext/call.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/node/ext/call.cc b/src/node/ext/call.cc
index b63e294f9a..fcad62261f 100644
--- a/src/node/ext/call.cc
+++ b/src/node/ext/call.cc
@@ -712,7 +712,11 @@ NAN_METHOD(Call::CancelWithStatus) {
Call *call = ObjectWrap::Unwrap<Call>(info.This());
grpc_status_code code = static_cast<grpc_status_code>(
Nan::To<uint32_t>(info[0]).FromJust());
- Utf8String details(info[0]);
+ if (code == GRPC_STATUS_OK) {
+ return Nan::ThrowRangeError(
+ "cancelWithStatus cannot be called with OK status");
+ }
+ Utf8String details(info[1]);
grpc_call_cancel_with_status(call->wrapped_call, code, *details, NULL);
}