feat: add error codes to genome API responses
Replace generic 'no genome data' message with specific error codes: - GENOME_NO_EXTRACTION: extraction entry not found - GENOME_VARIANT_QUERY_FAILED: variant query failed Makes debugging MCP issues much faster by pinpointing exact failure point. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
ba668ed5fd
commit
21bd173d70
|
|
@ -91,7 +91,11 @@ func handleGenomeQuery(w http.ResponseWriter, r *http.Request) {
|
|||
extraction, err := lib.GenomeGetExtraction(sysCtx, dossierID)
|
||||
if err != nil {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(map[string]string{"error": "no genome data for this dossier"})
|
||||
json.NewEncoder(w).Encode(map[string]interface{}{
|
||||
"error": "genome extraction entry not found",
|
||||
"code": "GENOME_NO_EXTRACTION",
|
||||
"detail": err.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -130,7 +134,11 @@ func handleGenomeQuery(w http.ResponseWriter, r *http.Request) {
|
|||
variants, err := lib.GenomeGetVariants(sysCtx, dossierID, tierIDs)
|
||||
if err != nil {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(GenomeResponse{Matches: []GenomeMatch{}, Returned: 0, Total: 0})
|
||||
json.NewEncoder(w).Encode(map[string]interface{}{
|
||||
"error": "failed to retrieve genome variants",
|
||||
"code": "GENOME_VARIANT_QUERY_FAILED",
|
||||
"detail": err.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue