Skip to content

Commit

Permalink
Stopped swallowing errors in moonloader.
Browse files Browse the repository at this point in the history
  • Loading branch information
eloff committed Jan 5, 2014
1 parent ce3d4ad commit f49e88b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
9 changes: 6 additions & 3 deletions moonscript/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,13 @@ moon_loader = function(name)
if file then
local text = file:read("*a")
file:close()
return loadstring(text, file_path)
else
return nil, "Could not find moon file"
local res, err = loadstring(text, file_path)
if not res then
error(err)
end
return res
end
return nil, "Could not find moon file"
end
if not package.moonpath then
package.moonpath = create_moonpath(package.path)
Expand Down
10 changes: 7 additions & 3 deletions moonscript/init.moon
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,13 @@ moon_loader = (name) ->
if file
text = file\read "*a"
file\close!
loadstring text, file_path
else
nil, "Could not find moon file"
res, err = loadstring text, file_path
if not res
error err

return res

return nil, "Could not find moon file"

if not package.moonpath
package.moonpath = create_moonpath package.path
Expand Down

0 comments on commit f49e88b

Please sign in to comment.