diff options
author | Marcel Laverdet <marcel@laverdet.com> | 2017-05-18 16:53:20 -0500 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-05-23 20:59:24 +0200 |
commit | 3c5bfba28bc9ed244daed7e8f8234b9a4529be85 (patch) | |
tree | 0f8eefe73aeaa4eea99448e6b747fe834100337c /src/node_contextify.cc | |
parent | a886b17bfb48147fa2007b9968e9dce706a408a2 (diff) | |
download | node-new-3c5bfba28bc9ed244daed7e8f8234b9a4529be85.tar.gz |
vm: fix displayErrors in runIn.. functions
This option has been broken for almost a year when used with any of the
vm.runIn.. family of functions, except for syntax errors.
PR-URL: https://github.com/nodejs/node/pull/13074
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/node_contextify.cc')
-rw-r--r-- | src/node_contextify.cc | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 970455bb25..9f2aa31dbb 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -736,8 +736,10 @@ class ContextifyScript : public BaseObject { return; } - Local<String> decorated_stack = String::Concat(arrow.As<String>(), - stack.As<String>()); + Local<String> decorated_stack = String::Concat( + String::Concat(arrow.As<String>(), + FIXED_ONE_BYTE_STRING(env->isolate(), "\n")), + stack.As<String>()); err_obj->Set(env->stack_string(), decorated_stack); err_obj->SetPrivate( env->context(), @@ -984,6 +986,9 @@ class ContextifyScript : public BaseObject { env->ThrowError("Script execution timed out."); } else if (received_signal) { env->ThrowError("Script execution interrupted."); + } else if (display_errors) { + // We should decorate non-termination exceptions + DecorateErrorStack(env, *try_catch); } // If there was an exception thrown during script execution, re-throw it. @@ -996,15 +1001,6 @@ class ContextifyScript : public BaseObject { return false; } - if (result.IsEmpty()) { - // Error occurred during execution of the script. - if (display_errors) { - DecorateErrorStack(env, *try_catch); - } - try_catch->ReThrow(); - return false; - } - args.GetReturnValue().Set(result); return true; } |