Skip to content

Commit c5e184b

Browse files
committed
refactor(php): remove t() wrapping from catch blocks in FieldDefinitionApiController
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 009f128 commit c5e184b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

lib/Controller/FieldDefinitionApiController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use OCP\AppFramework\Http\Attribute\ApiRoute;
1818
use OCP\AppFramework\Http\DataResponse;
1919
use OCP\AppFramework\OCSController;
20+
use OCP\IL10N;
2021
use OCP\IRequest;
2122

2223
/**
@@ -26,6 +27,7 @@ class FieldDefinitionApiController extends OCSController {
2627
public function __construct(
2728
IRequest $request,
2829
private FieldDefinitionService $fieldDefinitionService,
30+
private IL10N $l10n,
2931
) {
3032
parent::__construct(Application::APP_ID, $request);
3133
}
@@ -129,7 +131,7 @@ public function update(
129131
): DataResponse {
130132
$existing = $this->fieldDefinitionService->findById($id);
131133
if ($existing === null) {
132-
return new DataResponse(['message' => 'Field definition not found'], Http::STATUS_NOT_FOUND);
134+
return new DataResponse(['message' => $this->l10n->t('Field definition not found')], Http::STATUS_NOT_FOUND);
133135
}
134136

135137
try {
@@ -167,7 +169,7 @@ public function update(
167169
public function delete(int $id): DataResponse {
168170
$definition = $this->fieldDefinitionService->delete($id);
169171
if ($definition === null) {
170-
return new DataResponse(['message' => 'Field definition not found'], Http::STATUS_NOT_FOUND);
172+
return new DataResponse(['message' => $this->l10n->t('Field definition not found')], Http::STATUS_NOT_FOUND);
171173
}
172174

173175
return new DataResponse($definition->jsonSerialize(), Http::STATUS_OK);

0 commit comments

Comments
 (0)