From 8d389bca21336f4ad61caea0bd1b5ac4fd4afc63 Mon Sep 17 00:00:00 2001 From: Aire-One Date: Sat, 21 Jan 2023 21:01:42 +0100 Subject: [PATCH] fix(utils): `do_or_fail` `res` need to be promoted --- 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 a0453a5..828070e 100644 --- a/src/awesomewm.d.tl/utils.tl +++ b/src/awesomewm.d.tl/utils.tl @@ -58,12 +58,12 @@ function utils.do_or_fail(func: function(...: any): (T | nil, string), ... local ok, res, err = pcall(func, ...) - if not (ok and res) then + if not ok then log:error(logger.message_with_metadata("do_or_fail failed!", { error = err })) error(err) end - return res + return res as T -- promote to T since pcall succeeded at this point end return utils