diff options
author | Marcel Klehr <mklehr@gmx.net> | 2025-01-24 09:14:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-24 09:14:51 +0100 |
commit | d7ce5d4f94f9fe0c4915d0250dcee26ad72f95c6 (patch) | |
tree | 45322b85d943e0ba44f4810920cebbf8ad50d8c2 | |
parent | 4c6ecc6f15c7abbea51cb68184f8b34b77299adb (diff) | |
parent | 4fc0369984224e45090ab12fb6f9e948c168946c (diff) | |
download | nextcloud-server-d7ce5d4f94f9fe0c4915d0250dcee26ad72f95c6.tar.gz nextcloud-server-d7ce5d4f94f9fe0c4915d0250dcee26ad72f95c6.zip |
Merge pull request #46780 from nextcloud/fix/taskprocessing-better-errors
fix(TaskProcessing): Catch JSON encode errors in Manager#setTaskResult
-rw-r--r-- | lib/private/TaskProcessing/Manager.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index e2047be9c2c..2f3ba02634d 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -973,7 +973,7 @@ class Manager implements IManager { $task->setEndedAt(time()); $error = 'The task was processed successfully but the provider\'s output doesn\'t pass validation against the task type\'s outputShape spec and/or the provider\'s own optionalOutputShape spec'; $task->setErrorMessage($error); - $this->logger->error($error, ['exception' => $e]); + $this->logger->error($error . ' Output was: ' . var_export($result, true), ['exception' => $e]); } catch (NotPermittedException $e) { $task->setProgress(1); $task->setStatus(Task::STATUS_FAILED); @@ -990,7 +990,11 @@ class Manager implements IManager { $this->logger->error($error, ['exception' => $e]); } } - $taskEntity = \OC\TaskProcessing\Db\Task::fromPublicTask($task); + try { + $taskEntity = \OC\TaskProcessing\Db\Task::fromPublicTask($task); + } catch (\JsonException $e) { + throw new \OCP\TaskProcessing\Exception\Exception('The task was processed successfully but the provider\'s output could not be encoded as JSON for the database.', 0, $e); + } try { $this->taskMapper->update($taskEntity); $this->runWebhook($task); |