clickhouse icon indicating copy to clipboard operation
clickhouse copied to clipboard

Issue with regex used to identify clickhouse error messages

Open mike-luabase opened this issue 3 years ago • 7 comments

The regex used to catch error messages from the clickhouse server is missing error codes with 3 digits e.g. error code 215. The change below would fix it, but I don't know clickhouse well enough to determine if this will cause other issues.

const R_ERROR = new RegExp('(Code|Error): .*Exception: (.+?)$', 'm');

mike-luabase avatar Jan 01 '22 13:01 mike-luabase

@TimonKK is there any reason we need to keep the ([0-9]{2})[,.] part of the regex?

mike-luabase avatar Jan 01 '22 13:01 mike-luabase

I see you updated here in September, can we drop the # check?

https://github.com/TimonKK/clickhouse/commit/a84d890a1d2d509f1377b1c9abf7da28307a42fc

mike-luabase avatar Jan 01 '22 13:01 mike-luabase

What do you mean about "drop the # check"?

TimonKK avatar Jan 25 '22 21:01 TimonKK

@TimonKK the current regex is checking if there are numbers (([0-9]{2})[,.]) in the error code, is that necessary? If so, it'd need to check for at least three digits.

mike-luabase avatar Jan 26 '22 11:01 mike-luabase

I know ClickHouse has two digital error codes, for example, https://github.com/ClickHouse/ClickHouse/issues/33839. So I think to adjust regexp to '(Code|Error): ([0-9]{2,})[,.] .*Exception: (.+?)$'

TimonKK avatar Jan 26 '22 18:01 TimonKK

@TimonKK The problem is there are now three digit error codes, e.g. I got 215

mike-luabase avatar Jan 26 '22 19:01 mike-luabase

I understood about three-digit error codes. And I suggested new regexp /(Code|Error): ([0-9]{2,})[,.] .*Exception: (.+?)$/. You could test it on https://regexr.com/

TimonKK avatar Jan 26 '22 20:01 TimonKK