Compare commits

...

1 Commits

Author SHA1 Message Date
jmorganca
4c87a31ced server: continue to handle gin.H values until they are removed 2025-10-08 17:36:02 -07:00

View File

@@ -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