14 lines
257 B
Go
14 lines
257 B
Go
package handler
|
|
|
|
import "github.com/gin-gonic/gin"
|
|
|
|
type HandlerWithError func(c *gin.Context) error
|
|
|
|
func HandlerWithErrorWrapper(h HandlerWithError) gin.HandlerFunc {
|
|
return func(c *gin.Context) {
|
|
err := h(c)
|
|
if err != nil {
|
|
c.Error(err)
|
|
}
|
|
}
|
|
}
|