diff options
author | Gus Caplan <me@gus.host> | 2018-11-30 17:13:45 +0300 |
---|---|---|
committer | Gus Caplan <me@gus.host> | 2018-12-03 19:25:06 +0300 |
commit | f084e06de7b03750a80925a7aa1aefe3aed47504 (patch) | |
tree | a014956efe76cd2c1273811eb5efd4d30f784b94 /src/js_stream.cc | |
parent | dbdc9081fa723f62126ef857ee9365425e41dd9f (diff) |
src: use custom TryCatch subclass
PR-URL: https://github.com/nodejs/node/pull/24751
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'src/js_stream.cc')
-rw-r--r-- | src/js_stream.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/js_stream.cc b/src/js_stream.cc index 2d07b11b636..31e15ec3083 100644 --- a/src/js_stream.cc +++ b/src/js_stream.cc @@ -3,12 +3,15 @@ #include "async_wrap.h" #include "env-inl.h" #include "node_buffer.h" +#include "node_errors.h" #include "node_internals.h" #include "stream_base-inl.h" #include "v8.h" namespace node { +using errors::TryCatchScope; + using v8::Array; using v8::Context; using v8::FunctionCallbackInfo; @@ -18,7 +21,6 @@ using v8::Int32; using v8::Local; using v8::Object; using v8::String; -using v8::TryCatch; using v8::Value; @@ -42,7 +44,7 @@ bool JSStream::IsAlive() { bool JSStream::IsClosing() { HandleScope scope(env()->isolate()); Context::Scope context_scope(env()->context()); - TryCatch try_catch(env()->isolate()); + TryCatchScope try_catch(env()); Local<Value> value; if (!MakeCallback(env()->isclosing_string(), 0, nullptr).ToLocal(&value)) { if (!try_catch.HasTerminated()) @@ -56,7 +58,7 @@ bool JSStream::IsClosing() { int JSStream::ReadStart() { HandleScope scope(env()->isolate()); Context::Scope context_scope(env()->context()); - TryCatch try_catch(env()->isolate()); + TryCatchScope try_catch(env()); Local<Value> value; int value_int = UV_EPROTO; if (!MakeCallback(env()->onreadstart_string(), 0, nullptr).ToLocal(&value) || @@ -71,7 +73,7 @@ int JSStream::ReadStart() { int JSStream::ReadStop() { HandleScope scope(env()->isolate()); Context::Scope context_scope(env()->context()); - TryCatch try_catch(env()->isolate()); + TryCatchScope try_catch(env()); Local<Value> value; int value_int = UV_EPROTO; if (!MakeCallback(env()->onreadstop_string(), 0, nullptr).ToLocal(&value) || @@ -91,7 +93,7 @@ int JSStream::DoShutdown(ShutdownWrap* req_wrap) { req_wrap->object() }; - TryCatch try_catch(env()->isolate()); + TryCatchScope try_catch(env()); Local<Value> value; int value_int = UV_EPROTO; if (!MakeCallback(env()->onshutdown_string(), @@ -126,7 +128,7 @@ int JSStream::DoWrite(WriteWrap* w, bufs_arr }; - TryCatch try_catch(env()->isolate()); + TryCatchScope try_catch(env()); Local<Value> value; int value_int = UV_EPROTO; if (!MakeCallback(env()->onwrite_string(), |