Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClickHouseExceptionSpecifier returns ClickHouseUnknownException while underlying DB::Exception is actually known. #729

Closed
PavelRuban opened this issue Sep 26, 2021 · 2 comments · Fixed by #736
Labels
Milestone

Comments

@PavelRuban
Copy link

PavelRuban commented Sep 26, 2021

As far as I understand ClickHouseExceptionSpecifier is trying to extract the code of DB::Exception from the error message generated by clickhouse-server. It should return new ClickHouseException initialized with that extracted code if extraction was successful.

Unfortunately it looks like actual error message format is different from the one getErrorCode() method is expecting:
image

So getErrorCode() returns -1 instead of actually received code. That means exception was not recognized, so specify() returns ClickHouseUnknownException instead of ClickHouseException(code).

Also I found the string of such format could be returned from Exception::getExceptionMessage (https://github.com/ClickHouse/ClickHouse/blob/master/src/Common/Exception.cpp)
Line 476: stream << "Code: " << e.code() << ". " << text;

So I suggest to look for dot as well as for comma in order to extract error code correctly.

@zhicwu zhicwu added the bug label Sep 26, 2021
@zhicwu zhicwu added this to the 0.3.2 Release milestone Sep 26, 2021
@zhicwu zhicwu added the module-jdbc JDBC driver label Oct 6, 2021
@zhicwu
Copy link
Contributor

zhicwu commented Oct 6, 2021

This actually caused failures in integration test as well. It's been fixed and I'll come up with a PR to get it merged into develop branch.

@zhicwu zhicwu linked a pull request Oct 7, 2021 that will close this issue
@zhicwu
Copy link
Contributor

zhicwu commented Oct 10, 2021

Fixed in develop branch, will release in 0.3.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants