Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: roman <roman.habibov@tarantool.org>
Cc: tarantool-patches@freelists.org,
	Alexander Turenko <alexander.turenko@tarantool.org>,
	Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: Re: [tarantool-patches] Re: [PATCH 0/2 v2] fio: show function name in all fio errors
Date: Sun, 9 Dec 2018 12:36:00 +0300	[thread overview]
Message-ID: <20181209093600.qskbqppb3a3n53zq@esperanza> (raw)
In-Reply-To: <565504fd-61a3-092a-c9df-98b93c064a3c@tarantool.org>

On Sat, Dec 08, 2018 at 04:41:08PM +0300, roman wrote:
> diff --git a/src/lua/fio.lua b/src/lua/fio.lua
> index 55faebdcb..2fee13e2d 100644
> --- a/src/lua/fio.lua
> +++ b/src/lua/fio.lua
> @@ -188,7 +188,7 @@ fio.open = function(path, flags, mode)
>      for _, m in pairs(mode) do
>          if type(m) == 'string' then
>              if fio.c.mode[m] == nil then
> -                error(sprintf("Unknown mode: %s", m))
> +                error(sprintf("fio.open(): unknown mode: %s", m))

Here you use a colon (:) ...

>              end
>              imode = bit.bor(imode, fio.c.mode[m])
>          else
> @@ -213,7 +213,7 @@ fio.pathjoin = function(...)
>      while i <= len do
>          local sp = select(i, ...)
>          if sp == nil then
> -            error("Undefined path part "..i)
> +            error("fio.pathjoin() undefined path part "..i)

... while here you don't. Please be consistent throughout the code.

Also, there's already some inconsistency among existing error messages:

        error("Usage open(path[, flags[, mode]])")
	             ^^^^ fio prefix missing

        error("Usage fio.basename(path[, suffix])")
	           ^^^ semicolon missing

        error("Usage: fio.chdir(path)")

Please fix them all in the same patch. I think they all should look
like:

        error("Usage: fio.function(args)")

Don't forget to update the commit message accordingly (something like
"fio: cleanup error messages") and reset the author (git commit --amend
--reset-author) - for some reason Vladislav authored this commit.

> diff --git a/test/app/fio.result b/test/app/fio.result
> index b7a1f65c6..38d908276 100644
> --- a/test/app/fio.result
> +++ b/test/app/fio.result
> @@ -55,6 +55,19 @@ fio.pathjoin('abc', 'awdeq///qweqwqwe///', "//asda//")
>  ---
>  - abc/awdeq/qweqwqwe/asda
>  ...
> +--gh-3580 Modify the error message in 'fio.pathjoin'.

This is a confusing comment IMO. Let's just say something like

-- gh-3580: Check that error messages are descriptive enough.

> +fio.pathjoin(nil)
> +---
> +- error: 'builtin/fio.lua:216: fio.pathjoin() undefined path part 1'
> +...
> +fio.pathjoin('abc', nil)
> +---
> +- error: 'builtin/fio.lua:236: fio.pathjoin() undefined path part 2'
> +...
> +fio.pathjoin('abc', 'cde', nil)
> +---
> +- error: 'builtin/fio.lua:236: fio.pathjoin() undefined path part 3'
> +...

You patched error messages returned by several fio functions, but tested
only one them. Please check all fio functions while we are at it.

If you agree with all my comments, please don't reply to this email.
Instead send v2 with a proper change log in a new mailing thread.

Thanks.

      parent reply	other threads:[~2018-12-09  9:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-04 16:00 Roman Khabibov
2018-12-04 16:00 ` [PATCH 1/2 v2] lua: modify the error message in 'fio.pathjoin' Roman Khabibov
2018-12-04 16:00 ` [PATCH 2/2 v2] fio: show function name in all fio errors Roman Khabibov
2018-12-04 16:12 ` [PATCH 0/2 " Vladimir Davydov
2018-12-07  7:25   ` Alexander Turenko
2018-12-08 13:41     ` [tarantool-patches] " roman
2018-12-08 14:36       ` Alexander Turenko
2018-12-08 15:02         ` roman
2018-12-08 15:12           ` Alexander Turenko
2018-12-09  9:36       ` Vladimir Davydov [this message]

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=20181209093600.qskbqppb3a3n53zq@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=alexander.turenko@tarantool.org \
    --cc=roman.habibov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [tarantool-patches] Re: [PATCH 0/2 v2] fio: show function name in all fio errors' \
    /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