[tarantool-patches] Re: [PATCH v1 3/3] box: extend ffi error object API
Alexander Turenko
alexander.turenko at tarantool.org
Fri Aug 9 02:33:27 MSK 2019
> > +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.
More information about the Tarantool-patches
mailing list