Small fixes

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
Marcel Klehr 2023-09-07 13:03:38 +02:00
parent c8cab9d2fd
commit 2d44c7c1ed
2 changed files with 7 additions and 9 deletions

View file

@ -77,10 +77,9 @@ class TextToImageApiController extends \OCP\AppFramework\OCSController {
* @param string $appId ID of the app that will execute the task
* @param string $identifier An arbitrary identifier for the task
*
* @return DataResponse<Http::STATUS_OK, array{task: CoreTextToImageTask}, array{}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_PRECONDITION_FAILED, array{message: string}, array{}>
* @return DataResponse<Http::STATUS_OK, array{task: CoreTextToImageTask}, array{}>|DataResponse<Http::STATUS_PRECONDITION_FAILED, array{message: string}, array{}>
*
* 200: Task scheduled successfully
* 400: Scheduling task is not possible
* 412: Scheduling task is not possible
*/
#[PublicPage]
@ -122,9 +121,9 @@ class TextToImageApiController extends \OCP\AppFramework\OCSController {
return new DataResponse([
'task' => $json,
]);
} catch (TaskNotFoundException $e) {
} catch (TaskNotFoundException) {
return new DataResponse(['message' => $this->l->t('Task not found')], Http::STATUS_NOT_FOUND);
} catch (\RuntimeException $e) {
} catch (\RuntimeException) {
return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR);
}
}
@ -184,9 +183,9 @@ class TextToImageApiController extends \OCP\AppFramework\OCSController {
return new DataResponse([
'task' => $json,
]);
} catch (TaskNotFoundException $e) {
} catch (TaskNotFoundException) {
return new DataResponse(['message' => $this->l->t('Task not found')], Http::STATUS_NOT_FOUND);
} catch (\RuntimeException $e) {
} catch (\RuntimeException) {
return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR);
}
}
@ -214,7 +213,7 @@ class TextToImageApiController extends \OCP\AppFramework\OCSController {
return new DataResponse([
'tasks' => $json,
]);
} catch (\RuntimeException $e) {
} catch (\RuntimeException) {
return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR);
}
}

View file

@ -162,7 +162,7 @@ final class Task implements \JsonSerializable {
}
/**
* @psalm-return array{id: ?int, status: 0|1|2|3|4, userId: ?string, appId: string, input: string, output: ?string, identifier: string}
* @psalm-return array{id: ?int, status: 0|1|2|3|4, userId: ?string, appId: string, input: string, identifier: string}
* @since 28.0.0
*/
public function jsonSerialize(): array {
@ -172,7 +172,6 @@ final class Task implements \JsonSerializable {
'userId' => $this->getUserId(),
'appId' => $this->getAppId(),
'input' => $this->getInput(),
'result' => $this->getOutput(),
'identifier' => $this->getIdentifier(),
];
}