informatikr / hedis

A Redis client library for Haskell.
http://hackage.haskell.org/package/hedis
BSD 3-Clause "New" or "Revised" License
329 stars 127 forks source link

Exception handling question #35

Closed ondrap closed 8 years ago

ondrap commented 9 years ago

Hedis exports only 1 exception, but it seems to me that is unfortunately quite unwelcome. The problem is that thanks to unsafeInterleaveIO the exception can occur anywhere. Which would still be somewhat managable in the IO monad, but I need to use it on top of a transformer stack and catching IO exceptions there is really tricky. I ended up threading all calls through evaluate but that defies the purpose of optimal pipelining. (given the workflow I have no benefit from that anyway).

Throwing exceptions 'anywhere' doesn't seem to me a good design. Is there a way to not throw the exceptions? I.e. catch the exceptions somewhere during the communication and return Left/TxError instead? This would be nice haskellish design decision anyway.

qrilka commented 8 years ago

@ondrap could you give some example code when catching exception around runRedis is not enough?

k-bx commented 8 years ago

Should be fixed in 0.7.0