Tarantool development patches archive
 help / color / mirror / Atom feed
From: Nikita Pettik <korablev@tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH] box: always promote error created via box.error() to diag
Date: Thu, 2 Apr 2020 14:15:45 +0000	[thread overview]
Message-ID: <20200402141545.GB30923@tarantool.org> (raw)
In-Reply-To: <2d0316df-dda7-6438-d8cb-c7fd6290d830@tarantool.org>

On 02 Apr 02:37, Vladislav Shpilevoy wrote:
> Thanks for the patch!
> 
> On 01/04/2020 17:52, Nikita Pettik wrote:
> > Note that it is vital that box.error() now promotes error to diag, since
> > otherwise user is unable to set to diag custom error, which in turn is
> 
> Why unable? I thought we have box.error.set(). You can always do
> 
>     box.error.set(error_object)
>     box.error()

Lol. It was me who introduced box.error.set() a week ago and I've
already forgotten about it. *Facepalm*

Dropped corresponding paragraph from commit message.

Also @ChangeLog (2.4):

* box.error() now can accept error object as an argument. Behaviour
is the same as for 'code + reason' pair of arguments: error is set
to Tarantool's diagnostic area and is thrown.

> This is equivalent of
> 
>     box.error(error_object)
> 
> which you are doing in this patch.
> 
> But I am not against this patch. It is a nice sugar, when you need to
> both set + throw. It is LGTM except the commit message due to comments
> above.
> 
> > Closes #4829
> > 
> > @TarantoolBot document
> > Title: always promote error created via box.error() to diag
> > 
> > box.error() is able to accept two types of argument: either pair of code
> > + reason (box.error{code = 555, reason = 'Arbitrary message'}) or error
> > object (box.error(err)). In the first case error is promoted to
> > diagnostic area, meanwhile in the latter - it is not:
> > ```
> > e1 = box.error.new({code = 111, reason = "cause"})
> > box.error({code = 111, reason = "err"})
> > - error: err
> > box.error.last()
> > - err
> > box.error(e1)
> > - error: cause
> > box.error.last()
> > - err
> > ```
> > From now box.error(e1) sets error to diagnostic area as well:
> > ```
> > box.error(e1)
> > - error: cause
> > box.error.last()
> > - cause
> > ```
> > ---

  reply	other threads:[~2020-04-02 14:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-01 15:52 Nikita Pettik
2020-04-02  0:37 ` Vladislav Shpilevoy
2020-04-02 14:15   ` Nikita Pettik [this message]
2020-04-02 22:20     ` Vladislav Shpilevoy
2020-04-03  1:55       ` Nikita Pettik

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=20200402141545.GB30923@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] box: always promote error created via box.error() to diag' \
    /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