aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorMarcel Klehr <mklehr@gmx.net>2023-11-06 12:50:16 +0100
committerMarcel Klehr <mklehr@gmx.net>2023-11-06 12:50:16 +0100
commitd11b9cbd7993042fcf9ba49d5c8ef14bf928d901 (patch)
tree4a62c0255c3a7efa90dae441afd6afbd1484020a /lib/private
parent181f819e417a1818f37200f9071fa632c82a0fc2 (diff)
downloadnextcloud-server-d11b9cbd7993042fcf9ba49d5c8ef14bf928d901.tar.gz
nextcloud-server-d11b9cbd7993042fcf9ba49d5c8ef14bf928d901.zip
fix(TextProcessing/Manager): Throw TaskFailureException upon failure
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/TextProcessing/Manager.php10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/private/TextProcessing/Manager.php b/lib/private/TextProcessing/Manager.php
index bee70b53a33..439ffde4521 100644
--- a/lib/private/TextProcessing/Manager.php
+++ b/lib/private/TextProcessing/Manager.php
@@ -28,6 +28,7 @@ namespace OC\TextProcessing;
use OC\AppFramework\Bootstrap\Coordinator;
use OC\TextProcessing\Db\Task as DbTask;
use OCP\IConfig;
+use OCP\TextProcessing\Exception\TaskFailureException;
use OCP\TextProcessing\IProvider2;
use OCP\TextProcessing\Task;
use OCP\TextProcessing\Task as OCPTask;
@@ -139,22 +140,17 @@ class Manager implements IManager {
$task->setStatus(OCPTask::STATUS_SUCCESSFUL);
$this->taskMapper->update(DbTask::fromPublicTask($task));
return $output;
- } catch (\RuntimeException $e) {
- $this->logger->info('LanguageModel call using provider ' . $provider->getName() . ' failed', ['exception' => $e]);
- $task->setStatus(OCPTask::STATUS_FAILED);
- $this->taskMapper->update(DbTask::fromPublicTask($task));
- throw $e;
} catch (\Throwable $e) {
$this->logger->info('LanguageModel call using provider ' . $provider->getName() . ' failed', ['exception' => $e]);
$task->setStatus(OCPTask::STATUS_FAILED);
$this->taskMapper->update(DbTask::fromPublicTask($task));
- throw new RuntimeException('LanguageModel call using provider ' . $provider->getName() . ' failed: ' . $e->getMessage(), 0, $e);
+ throw new TaskFailureException('LanguageModel call using provider ' . $provider->getName() . ' failed: ' . $e->getMessage(), 0, $e);
}
}
$task->setStatus(OCPTask::STATUS_FAILED);
$this->taskMapper->update(DbTask::fromPublicTask($task));
- throw new RuntimeException('Could not run task');
+ throw new TaskFailureException('Could not run task');
}
/**