From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: lvasiliev <lvasiliev@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH v2 2/5] error: Add the custom error type Date: Thu, 16 Apr 2020 23:03:58 +0200 [thread overview] Message-ID: <a294d6ea-1644-56f4-9b0d-f7a5dd1bc0a3@tarantool.org> (raw) In-Reply-To: <428aeafc-58b5-899d-b62e-bf08853d3366@tarantool.org> Hi! Thanks for the answers! >>>>> @@ -111,9 +148,16 @@ raise: >>>>> line = info.currentline; >>>>> } >>>>> - struct error *err = box_error_new(file, line, code, "%s", reason); >>>>> - if (tb_parsed) >>>>> - err->traceback_mode = tb_mode; >>>>> + struct error *err = NULL; >>>>> + if (args.custom) { >>>>> + err = box_custom_error_new(file, line, args.custom, >>>>> + "%s", args.reason); >>>> >>>> 18. Code argument is ignored here. Although I am not sure it shouldn't >>>> be ignored. From what I remember, we decided that code should stay, >>>> but I may be wrong. >>> CustomError type has a predefinded code. Why it shouldn't be ignored? >> >> Because it is not a 'ClientError' object from user's point of view. The >> fact that we implemented it as a descendant of 'ClientError' class should >> not leak into the API. User can't assume anything about error hierarchies. >> He does not even see them. >> >> From user's point of view there are separate built-in 'ClientError'. And >> separate 'CustomError'. Both accept error code now. But 'CustomError' >> ignores it somewhy. Does not look right. >> > No, from user's point of view it have only type without any codes (In accordance with the task). The task says, I cite: "Ability to skip error codes if we don't need them". Not drop them. But skip when don't need. So essentially - make the code an optional parameter. > Besides, I think it's strange to have an AccessDeniedError with code "ER_SQL_PREPARE" (other branch of hierarchy). How AccessDeniedError is related to that? It is a different error type. Not ClientError, not CustomError. It does not have a code at all. > And user doesn't have an access to "code" of error. Well, they actually have. This is master branch: tarantool> e = box.error.new(1000, 'Message') --- ... tarantool> e.code --- - 1000 ... Talking of "user's point of view" regarding codes: ClientError has one meaning for error code. CustomError can have another. When you will add payload, users will add their codes for sure. Error code is something very basic for any more or less general error type. And if some of them will match our codes, it does not mean they have the same meaning. Some error types don't have a code - they type is enough. Such as AccessDeniedError. box.error.* codes only valid for ClientError objects. CustomError does not have any mapping of error codes. A user can define it.
next prev parent reply other threads:[~2020-04-16 21:04 UTC|newest] Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-10 8:10 [Tarantool-patches] [PATCH v2 0/5] Extending error functionality Leonid Vasiliev 2020-04-10 8:10 ` [Tarantool-patches] [PATCH v2 1/5] error: Add a Lua backtrace to error Leonid Vasiliev 2020-04-14 1:11 ` Vladislav Shpilevoy 2020-04-15 9:25 ` lvasiliev 2020-04-16 0:00 ` Vladislav Shpilevoy 2020-04-16 1:11 ` Alexander Turenko 2020-04-16 8:58 ` lvasiliev 2020-04-16 9:30 ` Alexander Turenko 2020-04-16 12:27 ` lvasiliev 2020-04-16 12:45 ` Alexander Turenko 2020-04-16 17:48 ` lvasiliev 2020-04-16 8:40 ` lvasiliev 2020-04-16 9:04 ` lvasiliev 2020-04-10 8:10 ` [Tarantool-patches] [PATCH v2 2/5] error: Add the custom error type Leonid Vasiliev 2020-04-14 1:11 ` Vladislav Shpilevoy 2020-04-15 9:25 ` lvasiliev 2020-04-16 0:02 ` Vladislav Shpilevoy 2020-04-16 9:18 ` lvasiliev 2020-04-16 21:03 ` Vladislav Shpilevoy [this message] 2020-04-10 8:10 ` [Tarantool-patches] [PATCH v2 3/5] error: Increase the number of fields transmitted through IPROTO Leonid Vasiliev 2020-04-14 1:12 ` Vladislav Shpilevoy 2020-04-15 9:25 ` lvasiliev 2020-04-16 0:02 ` Vladislav Shpilevoy 2020-04-10 8:10 ` [Tarantool-patches] [PATCH v2 4/5] iproto: Add session settings for IPROTO Leonid Vasiliev 2020-04-14 1:12 ` Vladislav Shpilevoy 2020-04-15 9:26 ` lvasiliev 2020-04-16 0:06 ` Vladislav Shpilevoy 2020-04-16 9:36 ` lvasiliev 2020-04-16 21:04 ` Vladislav Shpilevoy 2020-04-10 8:10 ` [Tarantool-patches] [PATCH v2 5/5] iproto: Update error MsgPack encoding Leonid Vasiliev 2020-04-14 1:12 ` Vladislav Shpilevoy 2020-04-15 9:25 ` lvasiliev 2020-04-16 0:11 ` Vladislav Shpilevoy 2020-04-16 10:04 ` lvasiliev 2020-04-16 21:06 ` Vladislav Shpilevoy 2020-04-14 1:10 ` [Tarantool-patches] [PATCH v2 0/5] Extending error functionality Vladislav Shpilevoy 2020-04-15 9:48 ` lvasiliev
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=a294d6ea-1644-56f4-9b0d-f7a5dd1bc0a3@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=lvasiliev@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v2 2/5] error: Add the custom error type' \ /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