summaryrefslogtreecommitdiff
path: root/src/api/exceptions.cc
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-02-24 21:52:14 +0100
committerAnna Henningsen <anna@addaleax.net>2019-03-05 22:40:00 +0100
commitc2f620ab76c3e42fa1fcdfde82aba7bcba3031e9 (patch)
tree05ae336d10e36944f1d65a7f7d72aeb12f58c6b6 /src/api/exceptions.cc
parentcc4e8e0696ffd5813df9cb50af7b47c27aaf2712 (diff)
downloadandroid-node-v8-c2f620ab76c3e42fa1fcdfde82aba7bcba3031e9.tar.gz
android-node-v8-c2f620ab76c3e42fa1fcdfde82aba7bcba3031e9.tar.bz2
android-node-v8-c2f620ab76c3e42fa1fcdfde82aba7bcba3031e9.zip
src: refactor `Environment::GetCurrent(isolate)` usage
Do not require an explicit `HandleScope`, or the ability to create one, when using `Environment::GetCurrent()`. `isolate->InContext()` is used as an indicator that it is probably okay to create a `HandleScope`, see also the short discussion in https://github.com/nodejs/node/pull/25775#pullrequestreview-197371049. PR-URL: https://github.com/nodejs/node/pull/26376 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/api/exceptions.cc')
-rw-r--r--src/api/exceptions.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/api/exceptions.cc b/src/api/exceptions.cc
index 897a4de365..ceac937408 100644
--- a/src/api/exceptions.cc
+++ b/src/api/exceptions.cc
@@ -28,6 +28,7 @@ Local<Value> ErrnoException(Isolate* isolate,
const char* msg,
const char* path) {
Environment* env = Environment::GetCurrent(isolate);
+ CHECK_NOT_NULL(env);
Local<Value> e;
Local<String> estring = OneByteString(isolate, errors::errno_string(errorno));
@@ -99,6 +100,7 @@ Local<Value> UVException(Isolate* isolate,
const char* path,
const char* dest) {
Environment* env = Environment::GetCurrent(isolate);
+ CHECK_NOT_NULL(env);
if (!msg || !msg[0])
msg = uv_strerror(errorno);
@@ -187,6 +189,7 @@ Local<Value> WinapiErrnoException(Isolate* isolate,
const char* msg,
const char* path) {
Environment* env = Environment::GetCurrent(isolate);
+ CHECK_NOT_NULL(env);
Local<Value> e;
bool must_free = false;
if (!msg || !msg[0]) {