Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Leonid Vasiliev <lvasiliev@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH] error: add format string usage to form a CustomError message
Date: Sat, 30 May 2020 00:05:10 +0200	[thread overview]
Message-ID: <8cfa7e20-d067-f77d-4300-0b228ad6e440@tarantool.org> (raw)
In-Reply-To: <db428fc6199eab0f08782b90efa6cef13fa1d812.1590654490.git.lvasiliev@tarantool.org>

Hi! Thanks for the patch!

On 28/05/2020 10:31, Leonid Vasiliev wrote:
> For the CustomError the ability to create a message
> using a format string was added.
> 
> Closes #4903
> 
> @TarantoolBot document
> Title: Add format string usage to form a CustomError message
> When creating a ClientError error the predefined format
> (corresponding with the error code) is used.
> When creating a CustomError error a format string can be
> used to form the message.
> 
> ClientError:
> ```Lua
> box.error(code, reason args)
> ```
> 
> CustomError:
> ```Lua
> box.error(type, reason format string, reason args)
> ```

It would be good to provide an example here. And to state, that
client error case is not changed. Otherwise from the text above
it looks like you changed it to be 'the predefined format is used'.
But I will leave it to the doc team to ping you after this is
pushed.

Talking of the client error formatting correctness, it looks like
currently the documentation says:
https://www.tarantool.io/en/doc/2.3/reference/reference_lua/box_error/#lua-function.box.error

	When called with a Lua-table argument, the code and reason have any user-desired values. The result will be those values.

	Parameters:

	reason (string) – description of an error, defined by user
	code (integer) – numeric code for this error, defined by user

So in the site it is said, that 'reason' is defined by user, not be
a predefined internal format. The predefined format is used in
box.error(code, ...) syntax.

> ---
> https://github.com/tarantool/tarantool/issues/4903
> https://github.com/tarantool/tarantool/tree/lvasiliev/gh-4903-format-string-for-CustomError
> @ChangeLog Add format string usage to form a CustomError message

  reply	other threads:[~2020-05-29 22:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-28  8:31 Leonid Vasiliev
2020-05-29 22:05 ` Vladislav Shpilevoy [this message]
2020-06-01 12:54   ` Leonid Vasiliev
2020-06-01 13:47     ` Vladislav Shpilevoy
2020-06-02 14:22 ` Kirill Yukhin

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=8cfa7e20-d067-f77d-4300-0b228ad6e440@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=lvasiliev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] error: add format string usage to form a CustomError 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