summaryrefslogtreecommitdiff
path: root/src/node_util.cc
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-06-02 15:47:53 +0200
committerRuben Bridgewater <ruben@bridgewater.de>2019-06-17 21:12:11 +0200
commit8849eb24c1c5f3da68500c9c462c4c74e92f90a3 (patch)
tree5c56e00079adef22343da2441a4d6c2bd8cf9b60 /src/node_util.cc
parent8a032fc50c51eea618f68fdf33ce7f5ed75025a2 (diff)
downloadandroid-node-v8-8849eb24c1c5f3da68500c9c462c4c74e92f90a3.tar.gz
android-node-v8-8849eb24c1c5f3da68500c9c462c4c74e92f90a3.tar.bz2
android-node-v8-8849eb24c1c5f3da68500c9c462c4c74e92f90a3.zip
src: handle exceptions from ToDetailString()
These methods may fail if execution is terminating. PR-URL: https://github.com/nodejs/node/pull/28019 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'src/node_util.cc')
-rw-r--r--src/node_util.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/node_util.cc b/src/node_util.cc
index 9e506f0e65..ab54c84379 100644
--- a/src/node_util.cc
+++ b/src/node_util.cc
@@ -125,8 +125,10 @@ static void PreviewEntries(const FunctionCallbackInfo<Value>& args) {
// Side effect-free stringification that will never throw exceptions.
static void SafeToString(const FunctionCallbackInfo<Value>& args) {
- auto context = args.GetIsolate()->GetCurrentContext();
- args.GetReturnValue().Set(args[0]->ToDetailString(context).ToLocalChecked());
+ Local<Context> context = args.GetIsolate()->GetCurrentContext();
+ Local<String> detail_string;
+ if (args[0]->ToDetailString(context).ToLocal(&detail_string))
+ args.GetReturnValue().Set(detail_string);
}
inline Local<Private> IndexToPrivateSymbol(Environment* env, uint32_t index) {