load: display a naughty notification when an error occurs on file loading

This commit is contained in:
Vincent Bernat 2012-07-10 22:21:04 +02:00
parent fa7d139a30
commit b5c655050d

5
rc.lua
View file

@ -11,6 +11,11 @@ function loadrc(name)
local path = awful.util.getdir("config") .. "/rc/" .. name .. ".lua" local path = awful.util.getdir("config") .. "/rc/" .. name .. ".lua"
success, result = pcall(function() return dofile(path) end) success, result = pcall(function() return dofile(path) end)
if not success then if not success then
naughty.notify({ title = "Error while loading an RC file",
text = "When loading `" .. name ..
"`, got the following error:\n" .. result,
preset = naughty.config.presets.critical
})
return print("E: error loading RC file '" .. name .. "': " .. result) return print("E: error loading RC file '" .. name .. "': " .. result)
end end
return result return result