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:
James 2026-02-09 14:49:31 -05:00
parent ba668ed5fd
commit 21bd173d70
1 changed files with 10 additions and 2 deletions

View File

@ -91,7 +91,11 @@ func handleGenomeQuery(w http.ResponseWriter, r *http.Request) {
extraction, err := lib.GenomeGetExtraction(sysCtx, dossierID) extraction, err := lib.GenomeGetExtraction(sysCtx, dossierID)
if err != nil { if err != nil {
w.Header().Set("Content-Type", "application/json") 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 return
} }
@ -130,7 +134,11 @@ func handleGenomeQuery(w http.ResponseWriter, r *http.Request) {
variants, err := lib.GenomeGetVariants(sysCtx, dossierID, tierIDs) variants, err := lib.GenomeGetVariants(sysCtx, dossierID, tierIDs)
if err != nil { if err != nil {
w.Header().Set("Content-Type", "application/json") 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 return
} }