diff options
| author | ruki <[email protected]> | 2019-05-23 00:49:55 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-05-22 22:59:33 +0800 |
| commit | af7907d7adc0c60930477730876f0ed74d3a9f5a (patch) | |
| tree | 4ceea76f5296c5a7d0851553a95ff33c1f2d5013 | |
| parent | 744ce235235533e695430daa1f96cbd35c69ac01 (diff) | |
improve trycall
| -rw-r--r-- | xmake/core/base/string.lua | 2 | ||||
| -rw-r--r-- | xmake/core/base/utils.lua | 9 |
2 files changed, 5 insertions, 6 deletions
diff --git a/xmake/core/base/string.lua b/xmake/core/base/string.lua index 5aabba734..b27d076d5 100644 --- a/xmake/core/base/string.lua +++ b/xmake/core/base/string.lua @@ -205,7 +205,7 @@ function string.tryformat(format, ...) if ok then return str else - return format + return tostring(format) end end diff --git a/xmake/core/base/utils.lua b/xmake/core/base/utils.lua index c8743a58f..3bd265ce3 100644 --- a/xmake/core/base/utils.lua +++ b/xmake/core/base/utils.lua @@ -190,15 +190,14 @@ function utils.trycall(script, traceback, ...) if errors then local _, pos = errors:find("[@encode(error)]: ", 1, true) if pos then - local deserrs - local rawerrs = errors:sub(pos + 1) - errors, deserrs = rawerrs:deserialize() + local errs = errors:sub(pos + 1) + errors, errs = errs:deserialize() if not errors then - errors = deserrs + errors = errs end if type(errors) == "table" then setmetatable(errors, { __tostring = function (self) - return rawerrs + return string.serialize(self) end }) end |
