From: Konstantin Belyavskiy <k.belyavskiy@tarantool.org>
To: tarantool-patches@freelists.org
Subject: [tarantool-patches] [PATCH] tarantoolctl: update confusing error message
Date: Thu, 9 Aug 2018 17:18:06 +0300 [thread overview]
Message-ID: <20180809141806.52803-1-k.belyavskiy@tarantool.org> (raw)
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)
next reply other threads:[~2018-08-09 14:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-09 14:18 Konstantin Belyavskiy [this message]
2018-08-20 17:03 ` Vladimir Davydov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180809141806.52803-1-k.belyavskiy@tarantool.org \
--to=k.belyavskiy@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='Re: [tarantool-patches] [PATCH] tarantoolctl: update confusing error message' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox