[Tarantool-patches] [PATCH vshard 4/5] error: introduce from_string

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sat Dec 18 02:10:29 MSK 2021


Thanks for the review!

On 17.12.2021 12:09, Oleg Babin wrote:
> Thanks for your patch. LGTM.
> 
> However we should probably use more neutral name that doesn't touch implementation details.
> 
> Maybe in future we will use new native custom errors that are available in new Tarantool versions.
> 
> So probably it's better to call this method e.g. deserialize. Feel free to ignore.

I used from_string() to be consistent with tostring(). Deserialize() would
assume there is serialize(), but there isn't. Also it won't work if the error is
packed into MessagePack. It works for strings only. Hence mentioning the exact
type 'string' seems valid.

As for native errors - I agree. The existence of from_string() is a huge
crutch. I was lucky that the errors were encoded as json in vshard from
the beginning. So I have at least sometimes working way of getting the original
error from an exception.

We have 'custom' error types in latest Tarantools for about a year now,
but it is still hardly usable, because you can't attach any payload to it. Which
is often very important even if it has just 1-2 fields. I wish the product
managers would see usefulness of good errors API someday.


More information about the Tarantool-patches mailing list