valkey-io/valkey-glide

Glide core should filter/translate errors from redis-rs for FFI clients

Yury-Fridlyand opened this issue · 0 comments

Describe the feature

Glide core uses redis-rs to communicate with Redis and translates received errors when submitting them into a protobuf response. FFI clients don't use protobuf and they receive too much error types. See RedisError in types.rs.
These error types should be translated into simple 4-5 types like it is defined in protobuf: https://github.com/aws/glide-for-redis/blob/cfc07802f52060144e661f32e9f4ae55c4a10a57/glide-core/src/protobuf/response.proto#L4-L9
(+ ClosingError)

Use Case

FFI client

Proposed Solution

PoC:

fn redis_error_to_ffi_error(err : RedisError) -> ErrorType {
    if err.is_connection_dropped() {
        ErrorType::ConnectionError
    } else if err.is_timeout() {
        ErrorType::TimeoutError
    } else if err.kind() == redis::ErrorKind::ExecAbortError {
        ErrorType::ExecAbortError
    } else {
        ErrorType::Unspecified
    }
}

Other Information

Consider creating new mod or even new crate called glide-ffi

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Client version used

N/A

Environment details (OS name and version, etc.)

N/A