diff --git a/main.go b/main.go index d0479e6..abadcc8 100644 --- a/main.go +++ b/main.go @@ -120,8 +120,14 @@ func main() { // Send the NATS request and wait synchronously for a reply (timeout: 30 seconds) reply, err := nc.RequestMsg(&msg, 30*time.Second) if err != nil { - http.Error(w, "Error processing request", http.StatusInternalServerError) log.Println("NATS request error:", err) + + // Handle specific NATS error cases + if err == nats.ErrNoResponders || strings.Contains(err.Error(), "no responders") { + http.Error(w, "No service available to handle request", http.StatusNotFound) + } else { + http.Error(w, "Error processing request", http.StatusInternalServerError) + } return }