handle article not found when patching

This commit is contained in:
2026-06-07 15:24:17 +02:00
parent f39f212e8a
commit fb273da418
+4
View File
@@ -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 {
if errors.Is(err, ErrNotFound) {
WriteError(writer, http.StatusNotFound, "article not found", nil)
} else {
WriteError(writer, http.StatusInternalServerError, "failed to write database", err)
}
return
}