Qovery / RedisLess

RedisLess is a fast, lightweight, embedded and scalable in-memory Key/Value store library compatible with the Redis API.
MIT License
150 stars 16 forks source link

Refactoring command handling of Errors #35

Closed clarity0 closed 3 years ago

clarity0 commented 3 years ago

Still have to implement traits Display and From for RedisCommandError to make it cleaner and actually return an error message to the client when one is caught , but the skeleton is there and tests pass on my machine.

evoxmusic commented 3 years ago

Let me know when it's done - it looks super nice

clarity0 commented 3 years ago

@evoxmusic seems good to go, errors are reported fine with the python client

[...] ~/Code/Redisless/clients/python/src >> python main.py
Traceback (most recent call last):
  File "/home/clarity/Code/Redisless/clients/python/src/main.py", line 39, in <module>
    redis.ttl('key')
  File "/usr/lib/python3.9/site-packages/redis/client.py", line 1861, in ttl
    return self.execute_command('TTL', name)
  File "/usr/lib/python3.9/site-packages/redis/client.py", line 901, in execute_command
    return self.parse_response(conn, command_name, **options)
  File "/usr/lib/python3.9/site-packages/redis/client.py", line 915, in parse_response
    response = connection.read_response()
  File "/usr/lib/python3.9/site-packages/redis/connection.py", line 756, in read_response
    raise response
redis.exceptions.ResponseError: command TTL not supported by redisless
evoxmusic commented 3 years ago

@evoxmusic seems good to go, errors are reported fine with the python client

[...] ~/Code/Redisless/clients/python/src >> python main.py
Traceback (most recent call last):
  File "/home/clarity/Code/Redisless/clients/python/src/main.py", line 39, in <module>
    redis.ttl('key')
  File "/usr/lib/python3.9/site-packages/redis/client.py", line 1861, in ttl
    return self.execute_command('TTL', name)
  File "/usr/lib/python3.9/site-packages/redis/client.py", line 901, in execute_command
    return self.parse_response(conn, command_name, **options)
  File "/usr/lib/python3.9/site-packages/redis/client.py", line 915, in parse_response
    response = connection.read_response()
  File "/usr/lib/python3.9/site-packages/redis/connection.py", line 756, in read_response
    raise response
redis.exceptions.ResponseError: command TTL not supported by redisless

is it a regression?

clarity0 commented 3 years ago

@evoxmusic

is it a regression?

what do you mean?

evoxmusic commented 3 years ago

The TTL command worked before? Or it was always failing? (we need to add tests for all clients)

clarity0 commented 3 years ago

The TTL command worked before? Or it was always failing? (we need to add tests for all clients)

No no it's not like that, the TTL command is not yet supported on main so it's supposed to fail with that error message, was just making sure that the error messages were fine.