Illustrating the difference between redis.call() and redis.pcall()

Viewed 9201

I tried executing the below erroneous eval command to understand the difference between redis.call() and redis.pcall()

eval "return redis.call(ARGV[2],KEYS[1])" 1 key get   
eval "return redis.pcall(ARGV[2],KEYS[1])" 1 key get

In both the cases, i got the error below,

(error) Lua redis() command arguments must be strings or integers

This error doesn't convey the difference between redis.call() and redis.pcall() as illustrated by the documentation which says

" redis.call() is similar to redis.pcall(), the only difference is that if a Redis command call will result into an error, redis.call() will raise a Lua error that in turn will force EVAL to return an error to the command caller, while redis.pcall will trap the error returning a Lua table representing the error."

So according to the documentation , in the case of using redis.pcall() the error should be trapped , right! In that case why are both the errors same?? If i have misconstrued the difference, it would be better if someone could clearly illustrate the difference between the commands!!

2 Answers
Related