redis-rb / redis-client

Simple low level client for Redis 6+
MIT License
125 stars 60 forks source link

Add `CommandError#command` to expose the command that caused the error #21

Closed casperisfine closed 2 years ago

casperisfine commented 2 years ago

Fix: https://github.com/redis-rb/redis-client/issues/20

I'm ok with the implementation complexity, it doesn't seem too bad to maintain, it's just a bit unfortunate to have 3 places to do it.

cc @mperham: if that implementation answer your need, I don't mind adding it.

mperham commented 2 years ago

I would add RDoc for command: returns the Array of elements for the command sent to Redis, just to note that the user should expect an Array. Alternatively you can use Array#join and make command return a String.

casperisfine commented 2 years ago

Alternatively you can use Array#join

I definitely prefer an array of strings over a single string as it's easy for the caller to join if they wish, whereas spliting correctly is non trivial.

As for RDoc, you're right, I need to do a full pass on it, not just this one property. I'll try to find some time for it either this week or after Rails conf.