Better check and error code

This commit is contained in:
Kruglov Pavel 2024-08-19 19:35:44 +02:00 committed by GitHub
parent dfd17cc2d7
commit 2f5fb44695
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -56,8 +56,8 @@ DataTypeObject::DataTypeObject(
/// Don't log errors to stderr.
options.set_log_errors(false);
auto regexp = re2::RE2(regexp_str, options);
if (!regexp.error().empty())
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Invalid regexp '{}': {}", regexp_str, regexp.error());
if (!regexp.ok())
throw Exception(ErrorCodes::CANNOT_COMPILE_REGEXP, "Invalid regexp '{}': {}", regexp_str, regexp.error());
}
for (const auto & [typed_path, type] : typed_paths)