Add HandlerWithError

This commit is contained in:
Dan Jones 2024-01-17 23:17:21 -06:00
commit 447f3b38ef
4 changed files with 186 additions and 0 deletions

14
handler.go Normal file
View file

@ -0,0 +1,14 @@
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)
}
}
}