andreiz / php-zookeeper

A PHP extension for interfacing with Apache ZooKeeper
Other
449 stars 215 forks source link

Maybe we can disable some warnings. #49

Closed Timandes closed 9 years ago

Timandes commented 9 years ago

When something was going wrong, it returns false.

We could get error code & message from getResultCode() & getResultMessage() just like php_memcached.

<?php

$zk = new Zookeeper('localhost:2181');
$r = $zk->set('/test', 123);
if (!$r) {
    echo $zk->getResultMessage() . "(#" . $zk->getResultCode() . ")";
}
echo "Done";
faabiosr commented 9 years ago

The best way to do this, is implement exceptions.

Timandes commented 9 years ago

@fabiorphp Could we handle this just like mysqli_driver::$report_mode?

andreiz commented 9 years ago

I really dislike mysqli_driver::$report_mode. There should be just one way to gather error information.

faabiosr commented 9 years ago

Seriously, I don't like report mode. In my humble opinion, we should think about exceptions. The correct use of exceptions, I believe that will be the best choice.

Timandes commented 9 years ago

All right, then. If you guys both like exceptions, should we start merging pull request #28? Or you have other plans?

faabiosr commented 9 years ago

Maybe, but for do that, we should check the entire PR commits and create tests for it, maybe use this PR for think in an ideia to make this possible

Timandes commented 9 years ago

@andreiz Could you create a new branch in order to complete feature about exceptions?

andreiz commented 9 years ago

@Timandes done

Timandes commented 9 years ago

@andreiz :heart_eyes:

faabiosr commented 9 years ago

:smile: Please close this issue!