Merge branch 'master' of github.com:nezhahq/nezha

This commit is contained in:
naiba
2024-12-31 23:58:49 +08:00
5 changed files with 16 additions and 12 deletions

View File

@@ -198,6 +198,8 @@ func (we *wsError) Error() string {
return fmt.Sprintf(we.msg, we.a...)
}
var errNoop = errors.New("wrote")
func commonHandler[T any](handler handlerFunc[T]) func(*gin.Context) {
return func(c *gin.Context) {
handle(c, handler)
@@ -240,7 +242,9 @@ func handle[T any](c *gin.Context, handler handlerFunc[T]) {
}
return
default:
c.JSON(http.StatusOK, newErrorResponse(err))
if !errors.Is(err, errNoop) {
c.JSON(http.StatusOK, newErrorResponse(err))
}
return
}
}