Tarantool development patches archive
 help / color / mirror / Atom feed
From: Alexander Turenko <alexander.turenko@tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@freelists.org,
	Kirill Shcherbatov <kshcherbatov@tarantool.org>,
	kostja@tarantool.org
Subject: [tarantool-patches] Re: [PATCH v1 3/3] box: extend ffi error object API
Date: Fri, 9 Aug 2019 02:33:27 +0300	[thread overview]
Message-ID: <20190808233327.sjm76nwf2qhxd4io@tkn_work_nb> (raw)
In-Reply-To: <55d56797-f937-4088-fdba-7d9dfef51ae6@tarantool.org>

> > +box_error_unwrap(box_error_t *error)
> > +{
> > +	struct error *reason = error->reason;
> > +	assert(reason != NULL);
> > +	diag_set_error(diag_get(), reason);
> > +	error_unref(reason);
> > +	error->reason = NULL;
> > +	return reason;
> 
> 7. Unwrap does not allow to unwrap a leaf error.
> But there is no API to determine if the error is
> leaf. So a user can't determine when to stop calling
> unwrap.
> 
> I am talking about C public API which you have changed
> here. A user can't check error->reason != NULL before
> calling box_error_unwrap.
> 
> Moreover, it is inconsistent with Lua version. Lets
> better return the argument when error->reason == NULL
> in box_error_unwrap. Then a user of the C API would
> just unwrap the stack until box_error_unwrap(e) == e.
> Also it simplifies Lua version implementation.

Why not just return NULL when there is no a reason? It seems to be more
logical for me.

  parent reply	other threads:[~2019-08-08 23:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-01 11:13 [tarantool-patches] [PATCH v1 0/3] box: stacked diagnostics area in fiber Kirill Shcherbatov
2019-08-01 11:13 ` [tarantool-patches] [PATCH v1 1/3] box: rfc for stacked diagnostic area in Tarantool Kirill Shcherbatov
2019-08-05 21:16   ` [tarantool-patches] " Vladislav Shpilevoy
     [not found]     ` <06bd2140-3d2b-4bc3-7bc4-5f3d293bf891@tarantool.org>
2019-08-06 20:50       ` Vladislav Shpilevoy
2019-08-07 23:27   ` Alexander Turenko
2019-08-08 20:46     ` Vladislav Shpilevoy
2019-08-08 23:29       ` Alexander Turenko
2019-08-09 19:25         ` Vladislav Shpilevoy
2019-08-12 20:35         ` Konstantin Osipov
2019-08-01 11:13 ` [tarantool-patches] [PATCH v1 2/3] box: stacked diagnostics area in fiber Kirill Shcherbatov
2019-08-05 21:16   ` [tarantool-patches] " Vladislav Shpilevoy
2019-08-01 11:13 ` [tarantool-patches] [PATCH v1 3/3] box: extend ffi error object API Kirill Shcherbatov
2019-08-05 21:18   ` [tarantool-patches] " Vladislav Shpilevoy
2019-08-06  7:56     ` Kirill Shcherbatov
2019-08-06 20:50       ` Vladislav Shpilevoy
2019-08-08 23:33     ` Alexander Turenko [this message]
2019-08-09 19:27       ` Vladislav Shpilevoy

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=20190808233327.sjm76nwf2qhxd4io@tkn_work_nb \
    --to=alexander.turenko@tarantool.org \
    --cc=kostja@tarantool.org \
    --cc=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='[tarantool-patches] Re: [PATCH v1 3/3] box: extend ffi error object API' \
    /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