Skip to content

Commit 93d5f4e

Browse files
committed
Context: Don't throw C++ exceptions
1 parent b310ab5 commit 93d5f4e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

binding.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ namespace zmq {
240240

241241
Context::Context(int io_threads) : Nan::ObjectWrap() {
242242
context_ = zmq_init(io_threads);
243-
if (!context_) throw std::runtime_error(ErrorMessage());
243+
if (!context_) Nan::ThrowError(ErrorMessage());
244244
}
245245

246246
Context *
@@ -251,7 +251,10 @@ namespace zmq {
251251
void
252252
Context::Close() {
253253
if (context_ != NULL) {
254-
if (zmq_term(context_) < 0) throw std::runtime_error(ErrorMessage());
254+
if (zmq_term(context_) < 0) {
255+
Nan::ThrowError(ErrorMessage());
256+
return;
257+
}
255258
context_ = NULL;
256259
}
257260
}

0 commit comments

Comments
 (0)