diff --git a/py_mini_racer/extension/mini_racer_extension.cc b/py_mini_racer/extension/mini_racer_extension.cc index cdb46e1a..266d063c 100644 --- a/py_mini_racer/extension/mini_racer_extension.cc +++ b/py_mini_racer/extension/mini_racer_extension.cc @@ -684,14 +684,18 @@ static BinaryValue* MiniRacer_eval_context_unsafe( Local tmp = Local::New(context_info->isolate, *eval_result.message); - bmessage = convert_v8_to_binary(context_info->isolate, *context_info->context, tmp); + if (eval_params.basic_only) { + bmessage = convert_basic_v8_to_binary(context_info->isolate, *context_info->context, tmp); + } else { + bmessage = convert_v8_to_binary(context_info->isolate, *context_info->context, tmp); + } } if (eval_result.backtrace) { Local tmp = Local::New(context_info->isolate, *eval_result.backtrace); - bbacktrace = convert_v8_to_binary(context_info->isolate, *context_info->context, tmp); + bbacktrace = convert_basic_v8_to_binary(context_info->isolate, *context_info->context, tmp); } } diff --git a/tests/test_strict.py b/tests/test_strict.py index 8e643be8..c49c778b 100644 --- a/tests/test_strict.py +++ b/tests/test_strict.py @@ -32,3 +32,7 @@ def test_call(self): self.assertIsNone(self.mr.eval(js_func)) self.assertEqual(self.mr.call('f', list(range(5))), 5) + + def test_message(self): + with self.assertRaises(py_mini_racer.JSEvalException): + res = self.mr.eval("throw new EvalError('Hello', 'someFile.js', 10);")