Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
namespace OCP\Files\Template;
+use OCP\Files\Template\InvalidFieldTypeException;
+
class Field implements \JsonSerializable {
private int $index;
private string $content;
$this->type = $type;
} else {
// TODO: Throw a proper enum with descriptive message
- $this->type = FieldType::tryFrom($type) ?? throw new \Exception();
+ $this->type = FieldType::tryFrom($type) ?? throw new InvalidFieldTypeException();
}
}
--- /dev/null
+<?php
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCP\Files\Template;
+
+/**
+ * Exception for invalid template field type
+ * @since 30.0.0
+ */
+class InvalidFieldTypeException extends \Exception {
+}