Catch exception during connection to the server

Bug in pecl gearman extension:

https://bugs.php.net/bug.php?id=63041