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

Make QueryError -> CassError conversion more accurate #133

Open
wprzytula opened this issue Jul 2, 2024 · 2 comments
Open

Make QueryError -> CassError conversion more accurate #133

wprzytula opened this issue Jul 2, 2024 · 2 comments
Labels
bug Something isn't working rust-driver-missing Functionality that Rust driver needs to implement first
Milestone

Comments

@wprzytula
Copy link
Collaborator

Problem

At the moment, the error conversion is much limited due to stringified errors in Rust driver.
The biggest offender in my opinion is:

    QueryError::InvalidMessage(_string) => CassError::CASS_ERROR_SERVER_INVALID_QUERY,

which is totally inaccurate, because SERVER_INVALID_QUERY strictly corresponds to DbError::Invalid. At the same time, QueryError::InvalidMessage is abused so much by converting all ParseErrors and FrameErrors to it.

Solution

Once the errors refactor lands in the Rust driver, a complex review of existing error conversion should be done to make it more accurate. Or else users moving from cpp-driver to cpp-rust-driver will get much confused by error messages. After all, failure deserializing a row may be displayed at the moment as "server invalid query".

@wprzytula wprzytula added rust-driver-missing Functionality that Rust driver needs to implement first bug Something isn't working labels Jul 2, 2024
@wprzytula wprzytula added this to the 0.2 milestone Jul 2, 2024
@wprzytula
Copy link
Collaborator Author

Another finding:
NewSessionError::ProtocolError is converted to a different error than QueryError::ProtocolError.

    NewSessionError::ProtocolError(_str) => {
        CassError::CASS_ERROR_LIB_UNABLE_TO_DETERMINE_PROTOCOL
    }
    DbError::ProtocolError => CassError::CASS_ERROR_SERVER_PROTOCOL_ERROR,

This is a mess.

@Lorak-mmk
Copy link
Collaborator

Yeah, when writing the initial version during the hachathon we didn't put much care in error conversions. Getting something that mostly works was more important.
After error refactor in Rust Driver is finished will be a good time to review the conversions to see which errors cpp-driver returns under which conditions and convert accordingly.

@muzarski muzarski modified the milestones: 0.2, 0.3 Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working rust-driver-missing Functionality that Rust driver needs to implement first
Projects
None yet
Development

No branches or pull requests

3 participants