ソースを参照

Print import errors when DEBUG is set

Lucas Stadler 9 年 前
コミット
be70524e7c
共有1 個のファイルを変更した13 個の追加1 個の削除を含む
  1. 13 1
      c/jsc-test.c

+ 13 - 1
c/jsc-test.c

@ -70,8 +70,20 @@ JSValueRef function_import_script(JSContextRef ctx, JSObjectRef function, JSObje
70 70
		JSStringRef script_ref = JSStringCreateWithUTF8CString(buf);
71 71
		free(buf);
72 72
73
		JSEvaluateScript(ctx, script_ref, NULL, path_str_ref, 0, NULL);
73
		JSValueRef ex = NULL;
74
		JSEvaluateScript(ctx, script_ref, NULL, path_str_ref, 0, &ex);
74 75
		JSStringRelease(script_ref);
76
77
#ifdef DEBUG
78
		if (ex != NULL) {
79
			JSStringRef ex_str = to_string(ctx, ex);
80
			char ex_buf[1000];
81
			ex_buf[0] = '\0';
82
			JSStringGetUTF8CString(ex_str, ex_buf, 1000);
83
			printf("import: %s\n", ex_buf);
84
			JSStringRelease(ex_str);
85
		}
86
#endif
75 87
	}
76 88
77 89
	return JSValueMakeUndefined(ctx);