From 4c87a31cedcc2f8edbdc6ba8352301be8888a29e Mon Sep 17 00:00:00 2001 From: jmorganca Date: Wed, 8 Oct 2025 17:33:12 -0700 Subject: [PATCH] server: continue to handle gin.H values until they are removed --- server/routes.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/server/routes.go b/server/routes.go index 5c9287453..bfb49eb30 100644 --- a/server/routes.go +++ b/server/routes.go @@ -555,6 +555,15 @@ func (s *Server) GenerateHandler(c *gin.Context) { case error: c.JSON(http.StatusInternalServerError, gin.H{"error": t.Error()}) return + // TODO (jmorganca): remove use of gin.H here and instead expect + // api.StatusError to be send in the channel + case gin.H: + if msg, ok := t["error"].(string); ok { + c.JSON(http.StatusInternalServerError, gin.H{"error": msg}) + return + } + c.JSON(http.StatusInternalServerError, gin.H{"error": "unexpected response"}) + return default: c.JSON(http.StatusInternalServerError, gin.H{"error": "unexpected response"}) return @@ -2099,6 +2108,15 @@ func (s *Server) ChatHandler(c *gin.Context) { case error: c.JSON(http.StatusInternalServerError, gin.H{"error": t.Error()}) return + // TODO (jmorganca): remove use of gin.H here and instead expect + // api.StatusError to be send in the channel + case gin.H: + if msg, ok := t["error"].(string); ok { + c.JSON(http.StatusInternalServerError, gin.H{"error": msg}) + return + } + c.JSON(http.StatusInternalServerError, gin.H{"error": "unexpected response"}) + return default: c.JSON(http.StatusInternalServerError, gin.H{"error": "unexpected response"}) return