From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 22F85272A3 for ; Thu, 9 Aug 2018 10:18:09 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3M32Rj7BmJ99 for ; Thu, 9 Aug 2018 10:18:09 -0400 (EDT) Received: from smtp2.mail.ru (smtp2.mail.ru [94.100.179.91]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id D483F27276 for ; Thu, 9 Aug 2018 10:18:08 -0400 (EDT) Received: by smtp2.mail.ru with esmtpa (envelope-from ) id 1fnllO-0004nq-Lj for tarantool-patches@freelists.org; Thu, 09 Aug 2018 17:18:07 +0300 From: Konstantin Belyavskiy Subject: [tarantool-patches] [PATCH] tarantoolctl: update confusing error message Date: Thu, 9 Aug 2018 17:18:06 +0300 Message-Id: <20180809141806.52803-1-k.belyavskiy@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org 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 extra/dist/tarantoolctl.in | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --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)