summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-04-30 22:49:54 +0800
committerruki <[email protected]>2020-04-30 10:59:28 +0800
commitbcf967b2abd338f9bcd3de403d5ebbaabf963d94 (patch)
treeae6d42e93489dccf50e865db541b540c0ce71455
parent7ddd265b1a3f420103dccdc0075c7a0e0679ccbb (diff)
improve errors msg
-rw-r--r--xmake/actions/install/main.lua2
-rw-r--r--xmake/actions/uninstall/main.lua2
-rw-r--r--xmake/core/base/io.lua4
-rw-r--r--xmake/core/base/os.lua18
-rw-r--r--xmake/core/base/pipe.lua4
-rw-r--r--xmake/core/base/poller.lua6
-rw-r--r--xmake/core/base/socket.lua4
-rw-r--r--xmake/core/sandbox/modules/os.lua4
-rw-r--r--xmake/modules/private/tools/vstool.lua4
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/Xmake.targets8
10 files changed, 24 insertions, 32 deletions
diff --git a/xmake/actions/install/main.lua b/xmake/actions/install/main.lua
index bd2a13813..d0f0f8d4c 100644
--- a/xmake/actions/install/main.lua
+++ b/xmake/actions/install/main.lua
@@ -130,7 +130,7 @@ function main()
ok = true
end
end
- assert(ok, "install failed, error: %s", errors or "unknown")
+ assert(ok, "install failed, %s", errors or "unknown reason")
end
}
}
diff --git a/xmake/actions/uninstall/main.lua b/xmake/actions/uninstall/main.lua
index a2ccd7284..4fa1f1bb4 100644
--- a/xmake/actions/uninstall/main.lua
+++ b/xmake/actions/uninstall/main.lua
@@ -92,7 +92,7 @@ function main()
ok = true
end
end
- assert(ok, "uninstall failed, error: %s", errors or "unknown")
+ assert(ok, "uninstall failed, %s", errors or "unknown reason")
end
}
}
diff --git a/xmake/core/base/io.lua b/xmake/core/base/io.lua
index 264afe59c..796704dd9 100644
--- a/xmake/core/base/io.lua
+++ b/xmake/core/base/io.lua
@@ -563,7 +563,7 @@ function io.open(filepath, mode, opt)
if file then
return _file.new(filepath, file)
else
- return nil, string.format("cannot open file: %s, error: %s", filepath, os.strerror())
+ return nil, string.format("cannot open file: %s, %s", filepath, os.strerror())
end
end
@@ -578,7 +578,7 @@ function io.openlock(filepath)
if lock then
return _filelock.new(filepath, lock)
else
- return nil, string.format("cannot open lock: %s, error: %s", filepath, os.strerror())
+ return nil, string.format("cannot open lock: %s, %s", filepath, os.strerror())
end
end
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index f4acb808c..44b11a6f7 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -59,7 +59,7 @@ function os._cp(src, dst, rootdir)
src = path.absolute(src)
end
if not src:startswith(rootdir) then
- return false, string.format("cannot copy file %s to %s, error: invalid rootdir(%s)", src, dst, rootdir)
+ return false, string.format("cannot copy file %s to %s, invalid rootdir(%s)", src, dst, rootdir)
end
end
@@ -77,7 +77,7 @@ function os._cp(src, dst, rootdir)
-- copy file
if not os.cpfile(src, dst) then
- return false, string.format("cannot copy file %s to %s, error: %s", src, dst, os.strerror())
+ return false, string.format("cannot copy file %s to %s, %s", src, dst, os.strerror())
end
-- is directory?
elseif os.isdir(src) then
@@ -93,12 +93,12 @@ function os._cp(src, dst, rootdir)
-- copy directory
if not os.cpdir(src, dst) then
- return false, string.format("cannot copy directory %s to %s, error: %s", src, dst, os.strerror())
+ return false, string.format("cannot copy directory %s to %s, %s", src, dst, os.strerror())
end
-- not exists?
else
- return false, string.format("cannot copy file %s, error: not found this file", src)
+ return false, string.format("cannot copy file %s, not found this file", src)
end
-- ok
@@ -438,7 +438,7 @@ function os.ln(srcpath, dstpath)
return false, string.format("symlink is not supported!")
end
if not os.link(srcpath, dstpath) then
- return false, string.format("cannot link %s to %s, error: %s", srcpath, dstpath, os.strerror())
+ return false, string.format("cannot link %s to %s, %s", srcpath, dstpath, os.strerror())
end
return true
end
@@ -501,7 +501,7 @@ function os.mkdir(dir)
local dirs = table.wrap(os._match_wildcard_pathes(dir))
for _, _dir in ipairs(dirs) do
if not os._mkdir(_dir) then
- return false, string.format("cannot create directory: %s, error: %s", _dir, os.strerror())
+ return false, string.format("cannot create directory: %s, %s", _dir, os.strerror())
end
end
return true
@@ -519,7 +519,7 @@ function os.rmdir(dir)
local dirs = table.wrap(os._match_wildcard_pathes(dir))
for _, _dir in ipairs(dirs) do
if not os._rmdir(_dir) then
- return false, string.format("cannot remove directory: %s, error: %s", _dir, os.strerror())
+ return false, string.format("cannot remove directory: %s, %s", _dir, os.strerror())
end
end
return true
@@ -630,7 +630,7 @@ function os.runv(program, argv, opt)
errors = string.format("runv(%s) failed(%d)", cmd, ok)
end
else
- errors = string.format("cannot runv(%s), error: %s", cmd, errors and errors or "unknown")
+ errors = string.format("cannot runv(%s), %s", cmd, errors and errors or "unknown reason")
end
-- remove the temporary log file
@@ -753,7 +753,7 @@ function os.iorunv(program, argv, opt)
if argv then
cmd = cmd .. " " .. os.args(argv)
end
- errors = string.format("cannot runv(%s), error: %s", cmd, errors and errors or "unknown")
+ errors = string.format("cannot runv(%s), %s", cmd, errors and errors or "unknown reason")
end
-- get output and error data
diff --git a/xmake/core/base/pipe.lua b/xmake/core/base/pipe.lua
index 16cdf6be5..b0fe74d2e 100644
--- a/xmake/core/base/pipe.lua
+++ b/xmake/core/base/pipe.lua
@@ -317,7 +317,7 @@ function pipe.open(name, mode, buffsize)
if pipefile then
return _instance.new(pipefile, name)
else
- return nil, string.format("failed to open pipe: %s, error: %s", name, errors or "unknown")
+ return nil, string.format("failed to open pipe: %s, %s", name, errors or "unknown reason")
end
end
@@ -334,7 +334,7 @@ function pipe.openpair(buffsize)
if rpipefile and wpipefile then
return _instance.new(rpipefile), _instance.new(wpipefile)
else
- return nil, nil, string.format("failed to open anonymous pipe pair, error: %s", errors or "unknown")
+ return nil, nil, string.format("failed to open anonymous pipe pair, %s", errors or "unknown reason")
end
end
diff --git a/xmake/core/base/poller.lua b/xmake/core/base/poller.lua
index 335ba98a6..4789a4d72 100644
--- a/xmake/core/base/poller.lua
+++ b/xmake/core/base/poller.lua
@@ -71,7 +71,7 @@ function poller:insert(obj, events, udata)
-- insert it
local ok, errors = io.poller_insert(obj:otype(), obj:cdata(), events)
if not ok then
- return false, string.format("%s: insert events(%d) to poller failed, error: %s", obj, events, errors or "unknown")
+ return false, string.format("%s: insert events(%d) to poller failed, %s", obj, events, errors or "unknown reason")
end
-- save poller object data and save obj/ref for gc
@@ -85,7 +85,7 @@ function poller:modify(obj, events, udata)
-- modify it
local ok, errors = io.poller_modify(obj:otype(), obj:cdata(), events)
if not ok then
- return false, string.format("%s: modify events(%d) to poller failed, error: %s", obj, events, errors or "unknown")
+ return false, string.format("%s: modify events(%d) to poller failed, %s", obj, events, errors or "unknown reason")
end
-- update poller object data
@@ -99,7 +99,7 @@ function poller:remove(obj)
-- remove it
local ok, errors = io.poller_remove(obj:otype(), obj:cdata())
if not ok then
- return false, string.format("%s: remove events from poller failed, error: %s", obj, errors or "unknown")
+ return false, string.format("%s: remove events from poller failed, %s", obj, errors or "unknown reason")
end
-- remove poller object data
diff --git a/xmake/core/base/socket.lua b/xmake/core/base/socket.lua
index 803ee4f5a..4ca589452 100644
--- a/xmake/core/base/socket.lua
+++ b/xmake/core/base/socket.lua
@@ -666,7 +666,7 @@ function socket.bind(addr, port, opt)
local ok, errors = sock:bind(addr, port)
if not ok then
sock:close()
- return nil, string.format("bind %s:%s failed, errors: %s!", addr, port, errors or "unknown")
+ return nil, string.format("bind %s:%s failed, %s!", addr, port, errors or "unknown reason")
end
return sock
end
@@ -680,7 +680,7 @@ function socket.bind_unix(addr, opt)
local ok, errors = sock:bind_unix(addr, opt)
if not ok then
sock:close()
- return nil, string.format("bind unix://%s failed, errors: %s!", addr, errors or "unknown")
+ return nil, string.format("bind unix://%s failed, %s!", addr, errors or "unknown reason")
end
return sock
end
diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua
index d9ebfe9d1..7f7e9db1b 100644
--- a/xmake/core/sandbox/modules/os.lua
+++ b/xmake/core/sandbox/modules/os.lua
@@ -341,7 +341,7 @@ function sandbox_os.exec(cmd, ...)
if ok ~= nil then
errors = string.format("exec(%s) failed(%d)", cmd, ok)
else
- errors = string.format("cannot exec(%s), error: %s", cmd, errors and errors or "unknown")
+ errors = string.format("cannot exec(%s), %s", cmd, errors and errors or "unknown reason")
end
os.raise(errors)
end
@@ -382,7 +382,7 @@ function sandbox_os.execv(program, argv, opt)
if ok ~= nil then
errors = string.format("execv(%s) failed(%d)", cmd, ok)
else
- errors = string.format("cannot execv(%s), error: %s", cmd, errors and errors or "unknown")
+ errors = string.format("cannot execv(%s), %s", cmd, errors and errors or "unknown reason")
end
os.raise(errors)
end
diff --git a/xmake/modules/private/tools/vstool.lua b/xmake/modules/private/tools/vstool.lua
index 7b124c5e7..e632ed00f 100644
--- a/xmake/modules/private/tools/vstool.lua
+++ b/xmake/modules/private/tools/vstool.lua
@@ -63,7 +63,7 @@ function runv(program, argv, opt)
if ok ~= nil then
errors = string.format("vstool.runv(%s) failed(%d)", cmd, ok)
else
- errors = string.format("vstool.runv(%s), error: %s", cmd, syserrors and syserrors or "unknown")
+ errors = string.format("vstool.runv(%s), %s", cmd, syserrors and syserrors or "unknown reason")
end
end
@@ -129,7 +129,7 @@ function iorunv(program, argv, opt)
if ok ~= nil then
errors = string.format("vstool.iorunv(%s) failed(%d)", cmd, ok)
else
- errors = string.format("vstool.iorunv(%s), error: %s", cmd, syserrors and syserrors or "unknown")
+ errors = string.format("vstool.iorunv(%s), %s", cmd, syserrors and syserrors or "unknown reason")
end
end
diff --git a/xmake/plugins/project/vsxmake/vsproj/Xmake.targets b/xmake/plugins/project/vsxmake/vsproj/Xmake.targets
index 50941ec6d..0519c2762 100644
--- a/xmake/plugins/project/vsxmake/vsproj/Xmake.targets
+++ b/xmake/plugins/project/vsxmake/vsproj/Xmake.targets
@@ -96,15 +96,11 @@
<Message Text="$xmake config $(_XmakeCommonFlags) $(_XmakeConfigFlags)" Importance="High" />
<Exec StdOutEncoding="utf-8" StdErrEncoding="utf-8" Command="$(_XmakeEnv)
$(_XmakeExecutable) config $(_XmakeCommonFlags) $(_XmakeConfigFlags)" EchoOff="true" />
- <Exec StdOutEncoding="utf-8" StdErrEncoding="utf-8" Command="$(_XmakeEnv)
- $(_XmakeExecutable) config $(_XmakeCommonFlags) $(_XmakeConfigFlags)" EchoOff="true" Condition="$(XmakeDiagnosis)" IgnoreStandardErrorWarningFormat="true" />
</Target>
<Target Name="_XmakeBuild" DependsOnTargets="_XmakeProjCheck">
<Message Text="$xmake build $(_XmakeCommonFlags) $(_XmakeBuildFlags) $(XmakeTarget)" Importance="High" />
<Exec StdOutEncoding="utf-8" StdErrEncoding="utf-8" Command="$(_XmakeEnv)
$(_XmakeExecutable) build $(_XmakeCommonFlags) $(_XmakeBuildFlags) $(XmakeTarget)" EchoOff="true" />
- <Exec StdOutEncoding="utf-8" StdErrEncoding="utf-8" Command="$(_XmakeEnv)
- $(_XmakeExecutable) build $(_XmakeCommonFlags) $(_XmakeBuildFlags) $(XmakeTarget)" EchoOff="true" Condition="$(XmakeDiagnosis)" IgnoreStandardErrorWarningFormat="true"/>
</Target>
<Target Name="_XmakeBuildFile" DependsOnTargets="_XmakeProjCheck">
<ItemGroup>
@@ -117,15 +113,11 @@
<Message Text="$xmake build $(_XmakeCommonFlags) $(_XmakeBuildFileFlags) $(FileFlag) $(XmakeTarget)" Importance="High" />
<Exec StdOutEncoding="utf-8" StdErrEncoding="utf-8" Command="$(_XmakeEnv)
$(_XmakeExecutable) build $(_XmakeCommonFlags) $(_XmakeBuildFileFlags) $(FileFlag) $(XmakeTarget)" EchoOff="true" />
- <Exec StdOutEncoding="utf-8" StdErrEncoding="utf-8" Command="$(_XmakeEnv)
- $(_XmakeExecutable) build $(_XmakeCommonFlags) $(_XmakeBuildFileFlags) $(FileFlag) $(XmakeTarget)" EchoOff="true" Condition="$(XmakeDiagnosis)" IgnoreStandardErrorWarningFormat="true" />
</Target>
<Target Name="_XmakeClean" DependsOnTargets="_XmakeProjCheck">
<Message Text="$xmake clean $(_XmakeCommonFlags) $(_XmakeCleanFlags) $(XmakeTarget)" Importance="High" />
<Exec StdOutEncoding="utf-8" StdErrEncoding="utf-8" Command="$(_XmakeEnv)
$(_XmakeExecutable) clean $(_XmakeCommonFlags) $(_XmakeCleanFlags) $(XmakeTarget)" EchoOff="true" />
- <Exec StdOutEncoding="utf-8" StdErrEncoding="utf-8" Command="$(_XmakeEnv)
- $(_XmakeExecutable) clean $(_XmakeCommonFlags) $(_XmakeCleanFlags) $(XmakeTarget)" EchoOff="true" Condition="$(XmakeDiagnosis)" IgnoreStandardErrorWarningFormat="true" />
</Target>
<Target Name="Show">