refactor: improve error handling and response formatting in API

This commit is contained in:
yusing
2025-05-03 17:41:10 +08:00
parent 82c829de18
commit 98e90d7a0b
31 changed files with 657 additions and 185 deletions

View File

@@ -69,7 +69,7 @@ func List(cfg config.ConfigInstance, w http.ResponseWriter, r *http.Request) {
}
icons, err := homepage.SearchIcons(r.FormValue("keyword"), limit)
if err != nil {
gphttp.ClientError(w, err)
gphttp.ClientError(w, r, err)
return
}
gphttp.RespondJSON(w, r, icons)