From 75c6062a3ed1764abcfbdb2e1adbd4692e43a13b Mon Sep 17 00:00:00 2001 From: Netkas Date: Sun, 18 Jun 2023 16:51:52 -0400 Subject: [PATCH] Minor changes in exception handling in \TamerLib\Classes > JobManager --- src/TamerLib/Classes/JobManager.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/TamerLib/Classes/JobManager.php b/src/TamerLib/Classes/JobManager.php index 6592778..52b42dc 100644 --- a/src/TamerLib/Classes/JobManager.php +++ b/src/TamerLib/Classes/JobManager.php @@ -138,7 +138,7 @@ * * @return void */ - private function disconnect(): void + public function disconnect(): void { 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 * @throws ConnectionException Thrown if there is a connection issue with the server * @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 * @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 * @throws ConnectionException Thrown if there is a connection issue with the server * @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 * @return JobPacket Returns the returned job as a JobPacket */ @@ -360,7 +358,15 @@ } Log::debug(Utilities::getName(), sprintf('Received job %s from return channel %s', $job_packet[1], $return_channel)); - return $this->getJob($job_packet[1]); + + try + { + 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); + } } /**