hedis icon indicating copy to clipboard operation
hedis copied to clipboard

Don't allow sending empty lists

Open k-bx opened this issue 9 years ago • 3 comments

In most APIs, it's an error to send an empty list as an argument. For example:

sadd "test-set" []

This will give you an error. Need to think to either switch to NonEmpty type or to skip empty lists somehow. Skipping is problematic since current API is exposing too much to a user, it returns a type corresponding to a redis-response, while I think it would be more logical to only return a success response, throwing exception (or skipping error) in other case.

k-bx avatar Feb 19 '16 09:02 k-bx

I agree that this case should always suceed. Other solutions require every callsite to handle empty sequences in some way, which just isn't useful.

We use hedis at imvu.com and we've baked this behaviour into a layer that we have just above Hedis.

andyfriesen avatar Jun 15 '16 14:06 andyfriesen

I agree this is required. I was bitten by this too just now:

> runRedis conn (del [])
Left (Error "ERR wrong number of arguments for 'del' command")

k0001 avatar Jul 07 '16 18:07 k0001

I favor switching to NonEmpty, by the way.

k0001 avatar Jul 07 '16 18:07 k0001