server: continue to handle gin.H values until they are removed
This commit is contained in:
parent
6a62b894c7
commit
4c87a31ced
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue