From fd8e13eaa9c2be3c16c27784206649943e6469d8 Mon Sep 17 00:00:00 2001 From: NOrtmann1 <145041949+NOrtmann1@users.noreply.github.com> Date: Wed, 10 Jun 2026 16:14:59 +0200 Subject: [PATCH] Update LocalArticleManager.php --- php/model/LocalArticleManager.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/php/model/LocalArticleManager.php b/php/model/LocalArticleManager.php index 5e65247..6df27e9 100644 --- a/php/model/LocalArticleManager.php +++ b/php/model/LocalArticleManager.php @@ -36,14 +36,19 @@ class LocalArticleManager implements ArticleManagerDAO { * Speichert alle Artikel/Beiträge in der Datei. * @param $articles * @return void - * TODO: Exceptions implementieren. + * @throws InternalServerErrorException */ - public function saveArticle($articles) + private function saveArticle($articles) { - file_put_contents( - $this->file, - json_encode($articles, JSON_PRETTY_PRINT) - ); + try{ + file_put_contents( + $this->file, + json_encode($articles, JSON_PRETTY_PRINT) + ); + }catch (Exception $e){ + throw new InternalServerErrorException($e->getMessage()); + } + } public function addArticle($title, $content, $author, $category, $tags)