* [tarantool-patches] [PATCH] tarantoolctl: update confusing error message
@ 2018-08-09 14:18 Konstantin Belyavskiy
2018-08-20 17:03 ` Vladimir Davydov
0 siblings, 1 reply; 2+ messages in thread
From: Konstantin Belyavskiy @ 2018-08-09 14:18 UTC (permalink / raw)
To: tarantool-patches
There were two complains regarding to tarantoolctl eval behaviour:
1. confusing message - fixed.
2. eval have correct return code there is no need in extra message
With built-in function 'error()' is used, we can have some
unexpected behaviour like: stat, err = pcall(error(1))
To distinguish case with error(message) from something went bad
suggest to use pattern "[string ...].
Closes #3560
---
Ticket: https://github.com/tarantool/tarantool/issues/3560
Branch: kbelyavs/gh-3560-tarantoolctl-eval-error-message
| 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--git a/extra/dist/tarantoolctl.in b/extra/dist/tarantoolctl.in
index f0529734f..47092fe12 100755
--- a/extra/dist/tarantoolctl.in
+++ b/extra/dist/tarantoolctl.in
@@ -749,6 +749,10 @@ local function status()
return 0
end
+string.startswith = function (self, start)
+ return self:sub(1, #start) == start
+end
+
local function eval()
local console_sock_path = uri.parse(console_sock).service
local filename = arg[3]
@@ -784,8 +788,9 @@ local function eval()
return 2
end
local error_response = yaml.decode(full_response)[1]
- if type(error_response) == 'table' and error_response.error then
- log.error("Error while reloading config:")
+ if type(error_response) == 'table' and error_response.error and
+ error_response.error:startswith("[string") then
+ log.error("Error while executing command:")
log.error(error_response.error)
return 3
end
--
2.14.3 (Apple Git-98)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [tarantool-patches] [PATCH] tarantoolctl: update confusing error message
2018-08-09 14:18 [tarantool-patches] [PATCH] tarantoolctl: update confusing error message Konstantin Belyavskiy
@ 2018-08-20 17:03 ` Vladimir Davydov
0 siblings, 0 replies; 2+ messages in thread
From: Vladimir Davydov @ 2018-08-20 17:03 UTC (permalink / raw)
To: tarantool-patches
On Thu, Aug 09, 2018 at 05:18:06PM +0300, Konstantin Belyavskiy wrote:
> There were two complains regarding to tarantoolctl eval behaviour:
> 1. confusing message - fixed.
> 2. eval have correct return code there is no need in extra message
> With built-in function 'error()' is used, we can have some
> unexpected behaviour like: stat, err = pcall(error(1))
> To distinguish case with error(message) from something went bad
> suggest to use pattern "[string ...].
Mons, who filed the issue, wanted us to remove this error message,
not fix it or anything else. I did it by myself.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-08-20 17:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-09 14:18 [tarantool-patches] [PATCH] tarantoolctl: update confusing error message Konstantin Belyavskiy
2018-08-20 17:03 ` Vladimir Davydov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox