mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
fix(TaskProcessing): Catch JSON encode errors in Manager#setTaskResult
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
parent
30a4f92202
commit
44aa380ce4
1 changed files with 6 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue