updateArticle-Exceptions
This commit is contained in:
@@ -61,16 +61,16 @@ class LocalArticleManager implements ArticleManagerDAO {
|
||||
|
||||
$this->saveArticle($articles);
|
||||
}
|
||||
|
||||
|
||||
public function updateArticle($id, $article, $author)
|
||||
{
|
||||
if (empty($article)) {
|
||||
throw new InvalidArgumentException("Der Beitrag darf nicht leer sein.");
|
||||
throw new InternalServerErrorException("internal_error");
|
||||
}
|
||||
|
||||
// Berechtigungsprüfung:
|
||||
if ($article->getAuthor() !== $author) {
|
||||
throw new UnauthorizedAccessException("Sie sind nicht berechtigt, diesen Artikel zu bearbeiten.");
|
||||
throw new UnauthorizedAccessException("unauthorized_access");
|
||||
}
|
||||
|
||||
// Beitrag aktualisieren:
|
||||
@@ -97,8 +97,7 @@ class LocalArticleManager implements ArticleManagerDAO {
|
||||
if ($updated) {
|
||||
$this->saveArticle($articles);
|
||||
} else {
|
||||
throw new NotFoundException("Ein Artikel mit der ID". $id . " wurde nicht gefunden.");
|
||||
|
||||
throw new NotFoundException("missing_id");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user