diff --git a/src/awesomewm.d.tl/utils.tl b/src/awesomewm.d.tl/utils.tl index 768af7f..4cd385c 100644 --- a/src/awesomewm.d.tl/utils.tl +++ b/src/awesomewm.d.tl/utils.tl @@ -58,9 +58,9 @@ end -- At some point, we should probably write a wrapper to make penlight's function work with pcalls. function utils.do_or_fail(func: function(...: any): (T | nil, string), ...: any): T local log = require "logger" - local res, err = func(...) + local ok, res, err = pcall(func, ...) - if not res then + if not (ok and res) then log:error { "do_or_fail failed!", error = err } error(err) end