From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Fri, 7 Dec 2018 10:25:35 +0300 From: Alexander Turenko Subject: Re: [PATCH 0/2 v2] fio: show function name in all fio errors Message-ID: <20181207072535.72jfepnrjj44vfnw@tkn_work_nb> References: <20181204161239.3ngth5tqnt33ixk2@esperanza> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20181204161239.3ngth5tqnt33ixk2@esperanza> To: Roman Khabibov , Vladislav Shpilevoy Cc: Vladimir Davydov , tarantool-patches@freelists.org List-ID: Hi all! I don't think we should hide a real function where an error occurs. We never know on what level the error was introduced. Let's see example: ``` local fio = require('fio') local function read_app_config(app_name) local config_dir = os.getenv('TARANTOOL_APP_CONFIG_DIR') or '/etc' local config_path = fio.pathjoin(config_dir, app_name .. '.cfg.lua') dofile(config_path) -- exposes config = { ... } variable return config or {} end local function init() local config = read_app_config(os.getenv('TARANTOOL_APP_NAME')) ... do some initialization ... end ``` When TARANTOOL_APP_NAME is not set in the example above the real error is in the init() function and not in the read_app_config(). An application can use xpcall + debug.traceback to show or log unexpected (or even expected) errors with full traceback. I think within scope of this issue we should only add function names into error messages and add path part number, but remove the second parameter of the error() function where it is used across the fio module. WBR, Alexander Turenko. On Tue, Dec 04, 2018 at 07:12:39PM +0300, Vladimir Davydov wrote: > Alexander, please take a look. > > On Tue, Dec 04, 2018 at 07:00:36PM +0300, Roman Khabibov wrote: > > Branch: https://github.com/tarantool/tarantool/tree/romanhabibov/gh-3580-err-msg-pathjoin > > Issue: https://github.com/tarantool/tarantool/issues/3580 > > > > Roman Khabibov (1): > > lua: modify the error message in 'fio.pathjoin' > > > > Vladislav Shpilevoy (1): > > fio: show function name in all fio errors > > > > src/lua/fio.lua | 30 +++++++++++++++--------------- > > test/app/fio.result | 13 +++++++++++++ > > test/app/fio.test.lua | 5 +++++ > > 3 files changed, 33 insertions(+), 15 deletions(-)