Public Access
handle article not found when patching
This commit is contained in:
@@ -293,7 +293,11 @@ func (h *ApiHandler) ServeBlogPatch(writer http.ResponseWriter, request *http.Re
|
|||||||
article.Id = id
|
article.Id = id
|
||||||
err = h.db.UpdateBlogArticle(article)
|
err = h.db.UpdateBlogArticle(article)
|
||||||
if err != nil {
|
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)
|
WriteError(writer, http.StatusInternalServerError, "failed to write database", err)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user