github.com/pluralsh/plural-cli@v0.9.5/pkg/server/middleware.go (about) 1 package server 2 3 import ( 4 "net/http" 5 6 "github.com/gin-gonic/gin" 7 ) 8 9 func ErrorHandler() gin.HandlerFunc { 10 return func(c *gin.Context) { 11 c.Next() 12 13 for _, err := range c.Errors { 14 c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) 15 } 16 } 17 }