Make skooma loaders fail when no file is found

This commit is contained in:
Talia 2023-06-20 20:01:22 +02:00
parent 7a42c32f36
commit 62183de78c
Signed by: darkwiiplayer
GPG key ID: 7808674088232B3E
2 changed files with 8 additions and 2 deletions

View file

@ -17,7 +17,10 @@ end})
-- @function load -- @function load
return function(name) return function(name)
name = tostring(name)..'.html.skooma' name = tostring(name)..'.html.skooma'
local template = loadfile(name, "t", env) local template, err = loadfile(name, "t", env)
if template == nil then
return nil, err
end
if setfenv then if setfenv then
setfenv(template, env) setfenv(template, env)
end end

View file

@ -17,7 +17,10 @@ end})
-- @function load -- @function load
return function(name) return function(name)
name = tostring(name)..'.xml.skooma' name = tostring(name)..'.xml.skooma'
local template = loadfile(name, "t", env) local template, err = loadfile(name, "t", env)
if template == nil then
return nil, err
end
if setfenv then if setfenv then
setfenv(template, env) setfenv(template, env)
end end