exq icon indicating copy to clipboard operation
exq copied to clipboard

Re-raise redix errors as Exq.RedisError

Open coop opened this issue 6 years ago • 0 comments

In my bug tracker I'm starting to see a fair few of these:

no match of right hand side value: {:error, %Redix.ConnectionError{reason: :timeout}}

Which is being called from Exq.Redis.Connection.zcard!/2etc. Having a look at the implementation each of the bang functions expect an ok tuple (which is fine). Just wondering if you'd be open to a pull request which catches the error and reraises with something specific to Exq so that I can filter out just those exceptions and not all redix connection errors?

I was thinking something like:

def zcard!(redis, x) do
  case current_implementation() do
    {:ok, value} -> value
    {:error, reason} -> raise Exq.RedisError, reason
end

Thoughts?

coop avatar May 30 '19 06:05 coop