/** * Handles exceptions thrown by Kohana and Gearman client, setting the * errors array as appropriate * * @param GearmanTask $task * @param Exception $exception * @return void * @author Sam de Freyssinet */ protected function _task_exception(GearmanTask $task, Exception $exception = NULL) { $uuid = $task->unique(); $error = $exception === NULL; $this->errors[$uuid] = array('type' => $error ? 'error' : 'exception', 'errorNo' => $error ? $this->_gearman_client->getErrno() : $exception->getCode(), 'error' => $error ? $this->_gearman_client->error() : $exception); }