praekeltfoundation / vumi

Messaging engine for the delivery of SMS, Star Menu and chat messages to diverse audiences in emerging markets and beyond.
BSD 3-Clause "New" or "Revised" License
420 stars 131 forks source link

Add response error constant to Redis managers so that exceptions can be caught sanely. #1026

Closed hodgestar closed 8 years ago

hodgestar commented 8 years ago

Currently one has to do:

try:
    redis.op(...)
except Exception:
    ...

for most redis operations because the class of exception raised depends on the kind of redis one has (sync, async, or fake).

Adding a RESPONSE_ERROR attribute to the redis manager would allow us to do:

try:
    redis.op(...)
except redis.RESPONSE_ERROR:
    ...

Much nicer.

hodgestar commented 8 years ago

@KaitCrawford Ready for review.

KaitCrawford commented 8 years ago

:+1: looks good to me