mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-07-03 10:04:30 +08:00
14 lines
263 B
Go
14 lines
263 B
Go
package middleware
|
|
|
|
import (
|
|
"gopkg.in/gin-gonic/gin.v1"
|
|
)
|
|
|
|
func ErrorHandler(c *gin.Context) {
|
|
c.Next()
|
|
|
|
if c.Errors.Last() != nil {
|
|
c.JSON(-1, gin.H{"code": c.Writer.Status(), "details": c.Errors.String()}) // -1 == not override the current error coe
|
|
}
|
|
}
|