diff --git a/core/Controller/TaskProcessingApiController.php b/core/Controller/TaskProcessingApiController.php index 00551b5d3e27c..9783299bccb1c 100644 --- a/core/Controller/TaskProcessingApiController.php +++ b/core/Controller/TaskProcessingApiController.php @@ -35,14 +35,10 @@ use OCP\AppFramework\Http\Attribute\UserRateLimit; use OCP\AppFramework\Http\DataDownloadResponse; use OCP\AppFramework\Http\DataResponse; -use OCP\Common\Exception\NotFoundException; use OCP\Files\File; -use OCP\Files\GenericFileException; use OCP\Files\IRootFolder; -use OCP\Files\NotPermittedException; use OCP\IL10N; use OCP\IRequest; -use OCP\Lock\LockedException; use OCP\TaskProcessing\EShapeType; use OCP\TaskProcessing\Exception\Exception; use OCP\TaskProcessing\Exception\UnauthorizedException; @@ -164,7 +160,7 @@ public function getTask(int $id): DataResponse { return new DataResponse([ 'task' => $json, ]); - } catch (NotFoundException $e) { + } catch (\OCP\TaskProcessing\Exception\NotFoundException $e) { return new DataResponse(['message' => $this->l->t('Task not found')], Http::STATUS_NOT_FOUND); } catch (\RuntimeException $e) { return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR); @@ -221,8 +217,6 @@ public function listTasksByApp(string $appId, ?string $customId = null): DataRes ]); } catch (Exception $e) { return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR); - } catch (\JsonException $e) { - return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR); } } @@ -250,8 +244,6 @@ public function listTasks(?string $taskType, ?string $customId = null): DataResp ]); } catch (Exception $e) { return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR); - } catch (\JsonException $e) { - return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR); } } @@ -287,7 +279,7 @@ public function getFileContents(int $taskId, int $fileId): Http\DataDownloadResp return new Http\DataDownloadResponse($node->getContent(), $node->getName(), $node->getMimeType()); } catch (\OCP\TaskProcessing\Exception\NotFoundException $e) { return new DataResponse(['message' => $this->l->t('Not found')], Http::STATUS_NOT_FOUND); - } catch (GenericFileException|NotPermittedException|LockedException|Exception $e) { + } catch (Exception $e) { return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR); } }