Skip to content

Commit d4d9a1b

Browse files
fix(script): improve error logging for syntax errors in watched files
1 parent d54ef8e commit d4d9a1b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/shell/script/script.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,10 @@ void script_context::watch_folder(const std::filesystem::path &path,
152152
JS_EVAL_FLAG_COMPILE_ONLY);
153153

154154
if (JS_IsException(func)) {
155-
std::cerr << "Error in file: " << path << std::endl;
155+
std::cerr << "Syntax Error in file: " << path << std::endl;
156+
auto val = qjs::Value{js->ctx, JS_GetException(js->ctx)};
157+
std::cerr << (std::string)val << (std::string)val["stack"]
158+
<< std::endl;
156159
JS_FreeValue(js->ctx, func);
157160
continue;
158161
}

0 commit comments

Comments
 (0)