Skip to content

Commit 79d7475

Browse files
targosAli Sheikh
authored and
Ali Sheikh
committed
src: fix TryCatch deprecation warnings
PR-URL: #4722 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Ali Ijaz Sheikh <[email protected]>
1 parent 81f1732 commit 79d7475

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/node.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -1604,7 +1604,7 @@ static Local<Value> ExecuteString(Environment* env,
16041604
Local<String> source,
16051605
Local<String> filename) {
16061606
EscapableHandleScope scope(env->isolate());
1607-
TryCatch try_catch;
1607+
TryCatch try_catch(env->isolate());
16081608

16091609
// try_catch must be nonverbose to disable FatalException() handler,
16101610
// we will handle exceptions ourself.
@@ -2327,7 +2327,7 @@ void FatalException(Isolate* isolate,
23272327
exit(6);
23282328
}
23292329

2330-
TryCatch fatal_try_catch;
2330+
TryCatch fatal_try_catch(isolate);
23312331

23322332
// Do not call FatalException when _fatalException handler throws
23332333
fatal_try_catch.SetVerbose(false);
@@ -3176,7 +3176,7 @@ void LoadEnvironment(Environment* env) {
31763176
// The node.js file returns a function 'f'
31773177
atexit(AtExit);
31783178

3179-
TryCatch try_catch;
3179+
TryCatch try_catch(env->isolate());
31803180

31813181
// Disable verbose mode to stop FatalException() handler from trying
31823182
// to handle the exception. Errors this early in the start-up phase

src/node_contextify.cc

+5-5
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ class ContextifyContext {
283283
env->context(),
284284
env->contextify_private_symbol()).FromJust());
285285

286-
TryCatch try_catch;
286+
TryCatch try_catch(env->isolate());
287287
ContextifyContext* context = new ContextifyContext(env, sandbox);
288288

289289
if (try_catch.HasCaught()) {
@@ -493,7 +493,7 @@ class ContextifyScript : public BaseObject {
493493
ContextifyScript* contextify_script =
494494
new ContextifyScript(env, args.This());
495495

496-
TryCatch try_catch;
496+
TryCatch try_catch(env->isolate());
497497
Local<String> code = args[0]->ToString(env->isolate());
498498
Local<String> filename = GetFilenameArg(args, 1);
499499
Local<Integer> lineOffset = GetLineOffsetArg(args, 1);
@@ -569,7 +569,7 @@ class ContextifyScript : public BaseObject {
569569
// args: [options]
570570
static void RunInThisContext(const FunctionCallbackInfo<Value>& args) {
571571
// Assemble arguments
572-
TryCatch try_catch;
572+
TryCatch try_catch(args.GetIsolate());
573573
uint64_t timeout = GetTimeoutArg(args, 0);
574574
bool display_errors = GetDisplayErrorsArg(args, 0);
575575
if (try_catch.HasCaught()) {
@@ -597,7 +597,7 @@ class ContextifyScript : public BaseObject {
597597

598598
Local<Object> sandbox = args[0].As<Object>();
599599
{
600-
TryCatch try_catch;
600+
TryCatch try_catch(env->isolate());
601601
timeout = GetTimeoutArg(args, 1);
602602
display_errors = GetDisplayErrorsArg(args, 1);
603603
if (try_catch.HasCaught()) {
@@ -618,7 +618,7 @@ class ContextifyScript : public BaseObject {
618618
return;
619619

620620
{
621-
TryCatch try_catch;
621+
TryCatch try_catch(env->isolate());
622622
// Do the eval within the context
623623
Context::Scope context_scope(contextify_context->context());
624624
if (EvalMachine(contextify_context->env(),

0 commit comments

Comments
 (0)