From b08528a710e36ac93af7f58fe135637e7fa6384c Mon Sep 17 00:00:00 2001 From: Aire-One Date: Sat, 22 Oct 2022 15:04:21 +0200 Subject: [PATCH] fix(utils): pcall protect `do_or_fail` --- src/awesomewm.d.tl/utils.tl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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