[PATCH 0/2 v2] fio: show function name in all fio errors

Alexander Turenko alexander.turenko at tarantool.org
Fri Dec 7 10:25:35 MSK 2018


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(-)



More information about the Tarantool-patches mailing list