summaryrefslogtreecommitdiff
path: root/src/api/exceptions.cc
diff options
context:
space:
mode:
authorSam Roberts <vieuxtech@gmail.com>2019-04-09 15:21:36 -0700
committerSam Roberts <vieuxtech@gmail.com>2019-04-12 12:33:37 -0700
commit060d901f87b3d87314f8540eb02f315e2952f581 (patch)
tree53159171201703bb6d8a4e780c8624a5c6c8cbb5 /src/api/exceptions.cc
parent7b0d8673898e65a368108264c77bccaa3e004028 (diff)
downloadandroid-node-v8-060d901f87b3d87314f8540eb02f315e2952f581.tar.gz
android-node-v8-060d901f87b3d87314f8540eb02f315e2952f581.tar.bz2
android-node-v8-060d901f87b3d87314f8540eb02f315e2952f581.zip
src: replace FromJust() with Check() when possible
FromJust() is often used not for its return value, but for its side-effects. In these cases, Check() exists, and is more clear as to the intent. From its comment: To be used, where the actual value of the Maybe is not needed, like Object::Set. See: https://github.com/nodejs/node/pull/26929/files#r269256335 PR-URL: https://github.com/nodejs/node/pull/27162 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Diffstat (limited to 'src/api/exceptions.cc')
-rw-r--r--src/api/exceptions.cc24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/api/exceptions.cc b/src/api/exceptions.cc
index 1025991063..ee5ea984eb 100644
--- a/src/api/exceptions.cc
+++ b/src/api/exceptions.cc
@@ -58,17 +58,17 @@ Local<Value> ErrnoException(Isolate* isolate,
Local<Object> obj = e.As<Object>();
obj->Set(env->context(),
env->errno_string(),
- Integer::New(isolate, errorno)).FromJust();
- obj->Set(env->context(), env->code_string(), estring).FromJust();
+ Integer::New(isolate, errorno)).Check();
+ obj->Set(env->context(), env->code_string(), estring).Check();
if (path_string.IsEmpty() == false) {
- obj->Set(env->context(), env->path_string(), path_string).FromJust();
+ obj->Set(env->context(), env->path_string(), path_string).Check();
}
if (syscall != nullptr) {
obj->Set(env->context(),
env->syscall_string(),
- OneByteString(isolate, syscall)).FromJust();
+ OneByteString(isolate, syscall)).Check();
}
return e;
@@ -144,13 +144,13 @@ Local<Value> UVException(Isolate* isolate,
e->Set(env->context(),
env->errno_string(),
- Integer::New(isolate, errorno)).FromJust();
- e->Set(env->context(), env->code_string(), js_code).FromJust();
- e->Set(env->context(), env->syscall_string(), js_syscall).FromJust();
+ Integer::New(isolate, errorno)).Check();
+ e->Set(env->context(), env->code_string(), js_code).Check();
+ e->Set(env->context(), env->syscall_string(), js_syscall).Check();
if (!js_path.IsEmpty())
- e->Set(env->context(), env->path_string(), js_path).FromJust();
+ e->Set(env->context(), env->path_string(), js_path).Check();
if (!js_dest.IsEmpty())
- e->Set(env->context(), env->dest_string(), js_dest).FromJust();
+ e->Set(env->context(), env->dest_string(), js_dest).Check();
return e;
}
@@ -219,21 +219,21 @@ Local<Value> WinapiErrnoException(Isolate* isolate,
Local<Object> obj = e.As<Object>();
obj->Set(env->context(), env->errno_string(), Integer::New(isolate, errorno))
- .FromJust();
+ .Check();
if (path != nullptr) {
obj->Set(env->context(),
env->path_string(),
String::NewFromUtf8(isolate, path, NewStringType::kNormal)
.ToLocalChecked())
- .FromJust();
+ .Check();
}
if (syscall != nullptr) {
obj->Set(env->context(),
env->syscall_string(),
OneByteString(isolate, syscall))
- .FromJust();
+ .Check();
}
if (must_free) {