From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 971CE6ECC0; Sat, 18 Dec 2021 02:11:24 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 971CE6ECC0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1639782684; bh=+JsD0Ke44kRFpxcAQGKbVVNHqc6SvdARLpruyW4wM94=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=a/cQHki37FdRQteVIL+utf9KMZfOnjFfw+Pwbe6EPIuMs0SnWqjLo8R7ecGlSz/Qz 6ucow9fkCd8RJxWlXu6vkcX1QS7s3C/YP3z0Ar1YdcjIiC1++Quwx7T4Fz12HX6jFn T/4hfUJLNGYSjdvl9Fiq41ncNcy/+nKo23C+DLnE= Received: from smtp39.i.mail.ru (smtp39.i.mail.ru [94.100.177.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 72B7B6ECDE for ; Sat, 18 Dec 2021 02:10:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 72B7B6ECDE Received: by smtp39.i.mail.ru with esmtpa (envelope-from ) id 1myMMv-00070X-Sk; Sat, 18 Dec 2021 02:10:30 +0300 Message-ID: Date: Sat, 18 Dec 2021 00:10:29 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Content-Language: en-US To: Oleg Babin , tarantool-patches@dev.tarantool.org References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-4EC0790: 10 X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD9B5397E24C93BDA67CDE94F05641003F35C2F85B8FC8660E1182A05F538085040817FD5FD26B499FD0BFE96BEF552D870893EBECDEA09C7B77FE4C1D74937B0BF X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE716FAD50E497B9C14EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006375E7A1B5661595F038638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D843775A5B30DFD01724E18691E1EFCD6D117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF1175FABE1C0F9B6A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18F04B652EEC242312D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE4B6963042765DA4BE21AE983DBD7FFC1D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE3A7DFDF579AB090EF2D242C3BD2E3F4C6C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637AF8E4F18C523FAA9EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 0D63561A33F958A58300305F5049E931E9FC2DD445A706842B19F9D9C50897C1D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA759D2A03B9C34326B3410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34A5112A9AECFE11B1FA1B6A35C0365FD135D363071460A40FEBDB59AF2C2C6F11CC547BA64188E64E1D7E09C32AA3244C5E4C6D413EAC743C40BD11A781CD415E259227199D06760A729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojieEIankJUzqtRZj6rt5Mzg== X-Mailru-Sender: 1F3202E75A95DDEFA8FDA09795F48B248655C2302DF3DFE5CD63D59FBEC736BB7BA6DE242C35196B07784C02288277CA03E0582D3806FB6A5317862B1921BA260ED6CFD6382C13A6B0DAF586E7D11B3E67EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH vshard 4/5] error: introduce from_string X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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.