diff options
author | Anna Henningsen <anna@addaleax.net> | 2017-11-27 03:31:24 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-11-29 17:58:42 +0300 |
commit | a01267265ac8f0c10a8a4d78015c9744352ae003 (patch) | |
tree | b9e280d17280383c952f5ca6d8f8c2df1cc53303 /src/node_url.cc | |
parent | 3c62f33d7ba0f0ec6124d5dc721811808803b8b7 (diff) |
src: remove `ClearFatalExceptionHandlers()`
At its call sites, `ClearFatalExceptionHandlers()` was used to
make the process crash as soon as possible once an exception occurred,
without giving JS land a chance to interfere.
`ClearFatalExceptionHandlers()` awkwardly removed the current domain
and any `uncaughtException` handlers, whereas a clearer way is to
execute the relevant reporting (and `exit()`) code directly.
PR-URL: https://github.com/nodejs/node/pull/17333
Refs: https://github.com/nodejs/node/pull/17159
Refs: https://github.com/nodejs/node/pull/17324
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'src/node_url.cc')
-rw-r--r-- | src/node_url.cc | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/node_url.cc b/src/node_url.cc index 67c6986da87..c9c8ccd5797 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -2172,19 +2172,16 @@ const Local<Value> URL::ToObject(Environment* env) const { }; SetArgs(env, argv, &context_); - TryCatch try_catch(isolate); - - // The SetURLConstructor method must have been called already to - // set the constructor function used below. SetURLConstructor is - // called automatically when the internal/url.js module is loaded - // during the internal/bootstrap_node.js processing. - MaybeLocal<Value> ret = - env->url_constructor_function() - ->Call(env->context(), undef, 9, argv); - - if (ret.IsEmpty()) { - ClearFatalExceptionHandlers(env); - FatalException(isolate, try_catch); + MaybeLocal<Value> ret; + { + FatalTryCatch try_catch(env); + + // The SetURLConstructor method must have been called already to + // set the constructor function used below. SetURLConstructor is + // called automatically when the internal/url.js module is loaded + // during the internal/bootstrap_node.js processing. + ret = env->url_constructor_function() + ->Call(env->context(), undef, arraysize(argv), argv); } return ret.ToLocalChecked(); |