diff --git a/php/controller/createArticle-controller.php b/php/controller/createArticle-controller.php index 5240c5e..0faf19b 100644 --- a/php/controller/createArticle-controller.php +++ b/php/controller/createArticle-controller.php @@ -1,10 +1,9 @@ newArticle($_POST['post-title'], $_POST['post-content'], $author); -} catch (PDOException $e) { - //TODO: Exception werfen, wenn das Erstellen des neuen Artikels nicht geklappt hat. + $articleManager->newArticle($_POST['post-title'], $_POST['post-content'], $author); +} catch (Exception $e) { + echo "Fehler beim Erstellen des Artikels: " . $e->getMessage(); } +?> \ No newline at end of file diff --git a/php/controller/index-controller.php b/php/controller/index-controller.php index c31481b..56b04c4 100644 --- a/php/controller/index-controller.php +++ b/php/controller/index-controller.php @@ -2,4 +2,9 @@ require_once 'php/model/ArticleManager.php'; require_once 'php/model/Article.php'; - +try { + $articleManager = new ArticleManager(); +}catch (Exception $e){ + die("Fehler bei der Initialisierung des Artikel-Managers: " . $e->getMessage()); +} +?> \ No newline at end of file diff --git a/php/model/Article.php b/php/model/Article.php index bae3240..e96ea98 100644 --- a/php/model/Article.php +++ b/php/model/Article.php @@ -71,4 +71,5 @@ class Article return $this->date; } -} \ No newline at end of file +} +?> \ No newline at end of file