From 81b99371f77264fa14de600867374cbc89eb1dfb Mon Sep 17 00:00:00 2001 From: Sainan Date: Fri, 19 Jan 2024 03:32:21 +0100 Subject: [PATCH] Forward errors in dofile --- plutoscript.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plutoscript.js b/plutoscript.js index 3f63c39..420c019 100644 --- a/plutoscript.js +++ b/plutoscript.js @@ -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