Skip to content

Commit

Permalink
Forward errors in dofile
Browse files Browse the repository at this point in the history
  • Loading branch information
Sainan committed Jan 19, 2024
1 parent 9a55a87 commit 81b9937
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plutoscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ libpluto().then(function(mod)
js_invoke = coroutine.yield
dofile = function(src)
return load(js_invoke("pluto_cmd_fetch", src))()
local chunk, err = load(js_invoke("pluto_cmd_fetch", src))
if not chunk then
error(err)
end
return chunk()
end
window = setmetatable({}, { -- silly little thingy to make 'window.alert' work
Expand Down

0 comments on commit 81b9937

Please sign in to comment.