fix(utils): add callback type to do_or_fail
ci/woodpecker/push/lint Pipeline was successful Details
ci/woodpecker/pr/lint Pipeline was successful Details
ci/woodpecker/push/build Pipeline was successful Details
ci/woodpecker/pr/build Pipeline was successful Details

See https://github.com/teal-language/tl/issues/569
This commit is contained in:
Aire-One 2022-10-04 19:58:07 +02:00
parent e8f38978dd
commit 66712f891a
1 changed files with 1 additions and 2 deletions

View File

@ -56,8 +56,7 @@ function utils.sanitize_string(s: string): string
end
-- At some point, we should probably write a wrapper to make penlight's function work with pcalls.
local type Func = function<T>(...: any): T | nil, string
function utils.do_or_fail<T>(func: Func<T>, ...: any): T
function utils.do_or_fail<T>(func: function<T>(...: any): (T | nil, string), ...: any): T
local log = require "logger"
local res, err = func(...)