Skip to content

Commit

Permalink
Show red error if loading plugin fails
Browse files Browse the repository at this point in the history
  • Loading branch information
yagop committed May 14, 2015
1 parent 58e4bf6 commit 5b48948
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions bot/bot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,17 @@ end
function load_plugins()
for k, v in pairs(_config.enabled_plugins) do
print("Loading plugin", v)
local t = loadfile("plugins/"..v..'.lua')()
plugins[v] = t

local ok, err = pcall(function()
local t = loadfile("plugins/"..v..'.lua')()
plugins[v] = t
end)

if not ok then
print('\27[31mError loading plugin '..v..'\27[39m')
print('\27[31m'..err..'\27[39m')
end

end
end

Expand Down

0 comments on commit 5b48948

Please sign in to comment.