I'm using the php gearman client and I'm trying to catch/ignore any errors in the event the gearman server is offline:
try {
$gearman = new GearmanClient();
$gearman->addServer('apps-1');
$gearman->setTimeout(4000);
$result = $gearman->doNormal("function", "params");
} catch (Exception $e) {}
However, this is still outputting the following error message:
Warning: GearmanClient::doNormal(): _client_do(GEARMAN_TIMEOUT) occured during gearman_client_run_tasks() -> libgearman/client.cc:154
I know the error message is just a warning not a fatal error but I was hoping the try/catch would suppress it. Anyone know of a way around this? Putting an @ symbol just before $gearman->doNormal() does suppress the error however I don't know if thats the politically correct way of doing it.
Can someone help me out?