From fb273da418d88c90992b1f246f648c401b460cdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Erbsh=C3=A4u=C3=9Fer?= Date: Sun, 7 Jun 2026 15:24:17 +0200 Subject: [PATCH] handle article not found when patching --- backend/blog.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/blog.go b/backend/blog.go index 5c17b0a..a656a0c 100644 --- a/backend/blog.go +++ b/backend/blog.go @@ -293,7 +293,11 @@ func (h *ApiHandler) ServeBlogPatch(writer http.ResponseWriter, request *http.Re article.Id = id err = h.db.UpdateBlogArticle(article) if err != nil { - WriteError(writer, http.StatusInternalServerError, "failed to write database", err) + if errors.Is(err, ErrNotFound) { + WriteError(writer, http.StatusNotFound, "article not found", nil) + } else { + WriteError(writer, http.StatusInternalServerError, "failed to write database", err) + } return }