grundgerüst Erstellt

This commit is contained in:
2023-04-02 14:06:26 +02:00
commit 9c3d1149bc
52 changed files with 2504 additions and 0 deletions

24
lib/Controller/Errors.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
// SPDX-FileCopyrightText: Christian Bock <christian@death600.de>
// SPDX-License-Identifier: AGPL-3.0-or-later
namespace OCA\VereinMitglieder\Controller;
use Closure;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCA\VereinMitglieder\Service\NoteNotFound;
trait Errors {
protected function handleNotFound(Closure $callback): DataResponse {
try {
return new DataResponse($callback());
} catch (NoteNotFound $e) {
$message = ['message' => $e->getMessage()];
return new DataResponse($message, Http::STATUS_NOT_FOUND);
}
}
}