Minor changes in exception handling in \TamerLib\Classes > JobManager

This commit is contained in:
Netkas 2023-06-18 16:51:52 -04:00
parent 1c98b388f2
commit 75c6062a3e
No known key found for this signature in database
GPG key ID: 5DAF58535614062B

View file

@ -138,7 +138,7 @@
* *
* @return void * @return void
*/ */
private function disconnect(): void public function disconnect(): void
{ {
if($this->isConnected()) if($this->isConnected())
{ {
@ -261,7 +261,6 @@
* @param int $timeout Optional. The number of seconds to wait for the status to change if $wait_for is set * @param int $timeout Optional. The number of seconds to wait for the status to change if $wait_for is set
* @throws ConnectionException Thrown if there is a connection issue with the server * @throws ConnectionException Thrown if there is a connection issue with the server
* @throws JobManagerException Thrown if there is an issue with the JobManager * @throws JobManagerException Thrown if there is an issue with the JobManager
* @throws JobNotFoundException Thrown if the JobPacket does not exist on the server
* @throws TimeoutException Thrown if the timeout is reached before the job status changes to one of the statuses in $wait_for * @throws TimeoutException Thrown if the timeout is reached before the job status changes to one of the statuses in $wait_for
* @see JobStatus for the integer values of the statuses * @see JobStatus for the integer values of the statuses
* @return int Returns the status of the job as an integer, see JobStatus for the integer values of the statuses * @return int Returns the status of the job as an integer, see JobStatus for the integer values of the statuses
@ -326,7 +325,6 @@
* @param int $timeout Optional. The number of seconds to wait for a job to be returned * @param int $timeout Optional. The number of seconds to wait for a job to be returned
* @throws ConnectionException Thrown if there is a connection issue with the server * @throws ConnectionException Thrown if there is a connection issue with the server
* @throws JobManagerException Thrown if there is an issue with the JobManager * @throws JobManagerException Thrown if there is an issue with the JobManager
* @throws JobNotFoundException Thrown if the JobPacket does not exist on the server
* @throws TimeoutException Thrown if the timeout is reached before a job is returned * @throws TimeoutException Thrown if the timeout is reached before a job is returned
* @return JobPacket Returns the returned job as a JobPacket * @return JobPacket Returns the returned job as a JobPacket
*/ */
@ -360,8 +358,16 @@
} }
Log::debug(Utilities::getName(), sprintf('Received job %s from return channel %s', $job_packet[1], $return_channel)); Log::debug(Utilities::getName(), sprintf('Received job %s from return channel %s', $job_packet[1], $return_channel));
try
{
return $this->getJob($job_packet[1]); return $this->getJob($job_packet[1]);
} }
catch(JobNotFoundException $e)
{
throw new JobManagerException(sprintf('Could not get job %s from %s:%s', $job_packet[1], $this->server_configuration->getHost(), $this->server_configuration->getPort()), $e);
}
}
/** /**
* Returns the unserialized return value of a job. * Returns the unserialized return value of a job.