0
#include "conversions.h"
0
@@ -57,40 +56,10 @@ static VALUE evaluate(int argc, VALUE* argv, VALUE self)
0
JS_ClearPendingException(context);
0
- if (johnson_context->ex)
0
- return rb_funcall(self, rb_intern("handle_js_exception"),
0
- 1, convert_to_ruby(runtime, johnson_context->ex));
0
- // VALUE message, file, line, stack;
0
- // assert(JS_GetProperty(context->js, JSVAL_TO_OBJECT(context->ex), "message", &js_message));
0
- // message = convert_to_ruby(context, js_message);
0
- // assert(JS_GetProperty(context->js, JSVAL_TO_OBJECT(context->ex), "fileName", &js_file));
0
- // file = convert_to_ruby(context, js_file);
0
- // assert(JS_GetProperty(context->js, JSVAL_TO_OBJECT(context->ex), "lineNumber", &js_line));
0
- // line = convert_to_ruby(context, js_line);
0
- // assert(JS_GetProperty(context->js, JSVAL_TO_OBJECT(context->ex), "stack", &js_stack));
0
- // stack = convert_to_ruby(context, js_stack);
0
- // return rb_funcall(self, rb_intern("handle_js_exception"),
0
- // 4, message, file, line, stack);
0
+ if (johnson_context->ex) {
0
+ RAISE_JS_ERROR(self, johnson_context->ex);
0
- char* msg = johnson_context->msg;
0
- // toString() whatever the exception object is (if we have one)
0
- if (johnson_context->ex)
0
- msg = JS_GetStringBytes(JS_ValueToString(context, johnson_context->ex));
0
- return Johnson_Error_raise(msg);
0
return convert_to_ruby(runtime, js);
0
@@ -189,7 +158,8 @@ initialize_native(VALUE self, VALUE UNUSED(options))
0
JS_DestroyRuntime(runtime->js);
0
- return Johnson_Error_raise("Couldn't initialize the runtime!");
0
+ rb_raise(rb_eRuntimeError, "Couldn't initialize the runtime!");
0
JSContext* johnson_get_current_context(JohnsonRuntime * runtime)