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 C859F6FC82; Fri, 12 Nov 2021 02:51:06 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C859F6FC82 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1636674666; bh=B4gD7LgDM8w2uAPClAJMmf5dYfbbl9Kc/DiwRZoyP4k=; 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=AeUUP6+7QF0nxpLffxjgn8LCwQI7s6640RUkJFtOF7tyEJRaKGgG6HXOVqVcJn5WI BgxEllDRxgK092U6GZP/9u7pqC950Dp6+V9iT827yT+3Zu9RrQeC/uxQGYnJf9aqx2 SF8NqGIjKtPC7qtzFJlLQ0F4JAnj4TddR8eIG3Qo= Received: from smtpng3.i.mail.ru (smtpng3.i.mail.ru [94.100.177.149]) (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 836516FC82 for ; Fri, 12 Nov 2021 02:50:54 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 836516FC82 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1mlJqH-0005Ac-Kn; Fri, 12 Nov 2021 02:50:54 +0300 Message-ID: <8de32cc0-1c9b-7fd5-2343-ff72567c43ba@tarantool.org> Date: Fri, 12 Nov 2021 00:50:52 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 To: Serge Petrenko , tarantool-patches@dev.tarantool.org, vdavydov@tarantool.org References: <375c2c4037f0517fa0801a752266530151544329.1636156453.git.v.shpilevoy@tarantool.org> <7b58d78b-2a74-71c3-6bd1-094746c73010@tarantool.org> Content-Language: en-US In-Reply-To: <7b58d78b-2a74-71c3-6bd1-094746c73010@tarantool.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9731B3922EC0639792A6D3A674C4858A6605C298C739846CB00894C459B0CD1B97D1E659AE410AA9558B587A242C7F8827F76FE7EF67E38FF0BFFC594198189FC X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7DB84ED444C624799EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637D636C6B786B38B6A8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8EA351EA226EA41E37D6674D7919C013E117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCAE9A1BBD95851C5BA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18F04B652EEC242312D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6300D3B61E77C8D3B089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458834459D11680B50537BF44C8E1EC058A871C09AF47631C94 X-C1DE0DAB: 0D63561A33F958A53BC885E92EE483AFD533F166669099D771E1E69FD0E68C1CD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7536C62C4FBC402878410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34BDCC71B3781C9C95A4A4ECB9DF366281974D258EF7CE74C52CCD073E0F38293D14D08C3C70D7A3D41D7E09C32AA3244C8EAE86B80D8311B9F2671497CB70A0FF4DBEAD0ED6C55A80FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj4t8MBgWr8bK60T4gP2R+tg== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5DF0D3493F6CDE8AACC69E76DFE10DE6573841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 3/9] error: move code to struct error from ClientError 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! >> diff --git a/src/lua/error.lua b/src/lua/error.lua >> index ebc784f07..9fb227df4 100644 >> --- a/src/lua/error.lua >> +++ b/src/lua/error.lua >> @@ -18,6 +18,7 @@ struct error { >>       const struct type_info *_type; >>       int64_t _refs; >>       int _saved_errno; >> +    int code; > > 1. All the other fields are prefixed with "_" for some reason. >    Let's do the same for "code", just to comply. I named it without '_' intentionally. Because then Lua will see this field right away when you do `err.code`. That also allows me not to define a getter in `error_fields` table. >>       /** Line number. */ >>       unsigned _line; >>       /* Source file name. */ >> @@ -158,7 +159,7 @@ local function error_unpack(err) >>       if not ffi.istype('struct error', err) then >>           error("Usage: error:unpack()") >>       end >> -    local result = {} >> +    local result = {code = err.code} > > 2. Why not add 'code' to 'error_fields' ? Because it is visible without a getter anyway. On the downside, here in unpack() I need to add it explicitly.