On ErrModelNotFound returns 404

This commit is contained in:
Ignasi 2025-04-15 11:54:16 +02:00
parent 0429a3ad8b
commit 991d931ada
No known key found for this signature in database
GPG Key ID: 504D4971A6A37388
1 changed files with 4 additions and 0 deletions

View File

@ -219,6 +219,10 @@ func (m *Manager) handleDeleteModel(w http.ResponseWriter, r *http.Request) {
err := m.distributionClient.DeleteModel(r.PathValue("name"))
if err != nil {
if errors.Is(err, distribution.ErrModelNotFound) {
http.Error(w, err.Error(), http.StatusNotFound)
return
}
m.log.Warnln("Error while deleting model:", err)
http.Error(w, err.Error(), http.StatusInternalServerError)
return