Skip to content

Commit b15ff8b

Browse files
committed
fix(TaskProcessingApi): Cleanup error handling
Signed-off-by: provokateurin <kate@provokateurin.de>
1 parent 4c375c9 commit b15ff8b

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

core/Controller/TaskProcessingApiController.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
use OCP\AppFramework\Http\Attribute\UserRateLimit;
3636
use OCP\AppFramework\Http\DataDownloadResponse;
3737
use OCP\AppFramework\Http\DataResponse;
38-
use OCP\Common\Exception\NotFoundException;
3938
use OCP\Files\File;
4039
use OCP\Files\GenericFileException;
4140
use OCP\Files\IRootFolder;
@@ -164,7 +163,7 @@ public function getTask(int $id): DataResponse {
164163
return new DataResponse([
165164
'task' => $json,
166165
]);
167-
} catch (NotFoundException $e) {
166+
} catch (\OCP\TaskProcessing\Exception\NotFoundException $e) {
168167
return new DataResponse(['message' => $this->l->t('Task not found')], Http::STATUS_NOT_FOUND);
169168
} catch (\RuntimeException $e) {
170169
return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR);
@@ -221,8 +220,6 @@ public function listTasksByApp(string $appId, ?string $customId = null): DataRes
221220
]);
222221
} catch (Exception $e) {
223222
return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR);
224-
} catch (\JsonException $e) {
225-
return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR);
226223
}
227224
}
228225

@@ -250,8 +247,6 @@ public function listTasks(?string $taskType, ?string $customId = null): DataResp
250247
]);
251248
} catch (Exception $e) {
252249
return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR);
253-
} catch (\JsonException $e) {
254-
return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR);
255250
}
256251
}
257252

@@ -287,7 +282,7 @@ public function getFileContents(int $taskId, int $fileId): Http\DataDownloadResp
287282
return new Http\DataDownloadResponse($node->getContent(), $node->getName(), $node->getMimeType());
288283
} catch (\OCP\TaskProcessing\Exception\NotFoundException $e) {
289284
return new DataResponse(['message' => $this->l->t('Not found')], Http::STATUS_NOT_FOUND);
290-
} catch (GenericFileException|NotPermittedException|LockedException|Exception $e) {
285+
} catch (Exception $e) {
291286
return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR);
292287
}
293288
}

0 commit comments

Comments
 (0)