[tarantool-patches] Re: [PATCH 2/2] sql: remove GLOB from Tarantool
Alex Khatskevich
avkhatskevich at tarantool.org
Fri Aug 17 12:28:37 MSK 2018
On 17.08.2018 12:20, n.pettik wrote:
>> On 17 Aug 2018, at 12:01, Alex Khatskevich <avkhatskevich at tarantool.org> wrote:
>>
>> On 17.08.2018 11:49, n.pettik wrote:
>>>> On 17 Aug 2018, at 11:25, Alex Khatskevich <avkhatskevich at tarantool.org> wrote:
>>>>
>>>> Do not split error messages at the middle of a sentence. It makes errors ungreppable.
>>>> Make it <80 somehow different.
>>> I guess this is extremely specific nitpicking: look at src/box/alter.cc:
>>> through the code there are a lot of breaks of error messages like:
>>>
>>> alter.c : 405
>>>
>>> tnt_raise(ClientError, errcode, tt_cstr(space_name, name_len),
>>> tt_sprintf("field %d has conflicting nullability and "
>>> "nullable action properties", fieldno +
>>> TUPLE_INDEX_BASE));
>>>
>>> alter.cc : 524
>>>
>>> if (exact_field_count != 0 &&
>>> exact_field_count < field_count) {
>>> tnt_raise(ClientError, errcode, tt_cstr(name, name_len),
>>> "exact_field_count must be either 0 or >= "\
>>> "formatted field count”);
>>>
>>> etc
>> That is not a good example of code.
> Okay, then look at key_def.c and other source files. I can’t find example of breaking
> 80 chars border with error string message. Thus, I guess this rule is unlikely to be
> supported within our codestyle.
>
>> If possible, error message should not be broken at the middle.
>> In my opinion, even if it is not possible, it should better be > 80.
>>
>> Linus is for this https://www.kernel.org/doc/html/v4.10/process/coding-style.html
>
>
As I said, I do not ask anyone to break the 80 rule. I ask to do not
split the error message.
it can be done that way for example:
```
const char * const err_msg =
"ESCAPE expression must be a single character";
if (sqlite3Utf8CharLen((char *)zEsc, -1) != 1) {
sqlite3_result_error(context,
err_msg,
-1);
return;
```
More information about the Tarantool-patches
mailing list