Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions internal/server/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (h *APIHandler) HandleGetPackage(w http.ResponseWriter, r *http.Request) {

info, err := h.enrichment.EnrichPackage(r.Context(), ecosystem, name)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
http.Error(w, "failed to enrich package", http.StatusInternalServerError)
return
}

Expand Down Expand Up @@ -209,7 +209,7 @@ func (h *APIHandler) HandleGetVersion(w http.ResponseWriter, r *http.Request) {

result, err := h.enrichment.EnrichFull(r.Context(), ecosystem, name, version)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
http.Error(w, "failed to enrich version", http.StatusInternalServerError)
return
}

Expand Down Expand Up @@ -291,7 +291,7 @@ func (h *APIHandler) HandleGetVulns(w http.ResponseWriter, r *http.Request) {

vulns, err := h.enrichment.CheckVulnerabilities(r.Context(), ecosystem, name, version)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
http.Error(w, "failed to check vulnerabilities", http.StatusInternalServerError)
return
}

Expand Down Expand Up @@ -485,7 +485,7 @@ func (h *APIHandler) HandleSearch(w http.ResponseWriter, r *http.Request) {
// Search in database
results, err := h.db.SearchPackages(query, ecosystem, limit, (page-1)*limit)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
http.Error(w, "search failed", http.StatusInternalServerError)
return
}

Expand Down Expand Up @@ -592,7 +592,7 @@ func (h *APIHandler) HandlePackagesList(w http.ResponseWriter, r *http.Request)

packages, err := h.db.ListCachedPackages(ecosystem, sortBy, limit, (page-1)*limit)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
http.Error(w, "failed to list packages", http.StatusInternalServerError)
return
}

Expand Down
2 changes: 1 addition & 1 deletion internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ func (s *Server) handleHealth(w http.ResponseWriter, r *http.Request) {
// Check database connectivity
if _, err := s.db.SchemaVersion(); err != nil {
w.WriteHeader(http.StatusServiceUnavailable)
_, _ = fmt.Fprintf(w, "database error: %v", err)
_, _ = fmt.Fprint(w, "database error")
return
}

Expand Down