Wafris / wafris-rb

Wafris Client for Rails and Rack applications
https://wafris.org
Other
101 stars 9 forks source link

Proposal: be more specific around Redis errors #66

Closed ruyrocha closed 10 months ago

ruyrocha commented 10 months ago

The context behind this: the Middleware is treating Redis exceptions as standard errors.

There is a define list of possible Redis errors:

    ERROR_MAPPING = {
      RedisClient::ConnectionError => Redis::ConnectionError,
      RedisClient::CommandError => Redis::CommandError,
      RedisClient::ReadTimeoutError => Redis::TimeoutError,
      RedisClient::CannotConnectError => Redis::CannotConnectError,
      RedisClient::AuthenticationError => Redis::CannotConnectError,
      RedisClient::FailoverError => Redis::CannotConnectError,
      RedisClient::PermissionError => Redis::PermissionError,
      RedisClient::WrongTypeError => Redis::WrongTypeError,
      RedisClient::ReadOnlyError => Redis::ReadOnlyError,
      RedisClient::ProtocolError => Redis::ProtocolError,
      RedisClient::OutOfMemoryError => Redis::OutOfMemoryError,
    }

So the proposal here is to be a little more specific around the errors, having more insights on what's going on Redis side.

ruyrocha commented 10 months ago

Closing in favor of major upcoming refactor.