mirror of
https://github.com/leafo/moonscript.git
synced 2024-11-22 02:44:23 +00:00
show error message from loadfile if there is one
This commit is contained in:
parent
7d2f57d9f2
commit
8c2be55dbb
10
bin/moon
10
bin/moon
@ -47,9 +47,9 @@ local new_arg = {
|
||||
select(ind + 1, unpack(arg))
|
||||
}
|
||||
|
||||
local moonscript_chunk
|
||||
local moonscript_chunk, lua_parse_error
|
||||
local passed, err = pcall(function()
|
||||
moonscript_chunk = moonscript.loadfile(script_fname)
|
||||
moonscript_chunk, lua_parse_error = moonscript.loadfile(script_fname)
|
||||
end)
|
||||
|
||||
if not passed then
|
||||
@ -58,7 +58,11 @@ if not passed then
|
||||
end
|
||||
|
||||
if not moonscript_chunk then
|
||||
print_err("Can't find file: " .. script_fname)
|
||||
if lua_parse_error then
|
||||
print_err(lua_parse_error)
|
||||
else
|
||||
print_err("Can't find file: " .. script_fname)
|
||||
end
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user