nrk / phpiredis

PHP extension for Redis based on Hiredis
BSD 2-Clause "Simplified" License
490 stars 66 forks source link

Allow setting an error handler #19

Closed theintz closed 10 years ago

theintz commented 10 years ago

This changeset introduces phpiredis_set_error_handler(), which allows a user to register a PHP callable as an error handler. This handler is called when an error is encountered in the communication with the Redis server. It should correspond to the following signature: function ($errorType, $errorMessage)

$errorType is one of PHPIREDIS_ERROR_CONNECTION and PHPIREDIS_ERROR_PROTOCOL, $errorMessage is just the message as a string.

I am already opening this pull request to get some input as to whether this approach is fine for everyone. Also my C isn't the best, so please let me know if there is a mistake somewhere.

Still left to do:

theintz commented 10 years ago

Any feedback?

nrk commented 10 years ago

Sorry for the lack of feedback @theintz I've been too busy in the last couple of weeks, I hope to be able to review your PR during the weekend or at the start of next week at worst. In the meanwhile, if anyone else has feedback on this PR please feel free to comment.

Thanks!

theintz commented 10 years ago

Replaced by #23.