summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2017-03-07 00:25:13 -0800
committerSteve Manuel <nilslice@gmail.com>2017-03-07 00:25:13 -0800
commitef28c19b8237e03bd521118b04109e9922c9d51d (patch)
tree355461bf2e71a32e230d2fe39baaee29d9a46fc3
parenta4517988cd2a3d25603adff58a01a3d3d4cf501b (diff)
adding catch for ErrRecursivePush log and ignoring null values
-rw-r--r--system/api/push.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/system/api/push.go b/system/api/push.go
index b7c5642..a6402bc 100644
--- a/system/api/push.go
+++ b/system/api/push.go
@@ -7,6 +7,7 @@ import (
"github.com/ponzu-cms/ponzu/system/item"
"github.com/tidwall/gjson"
+ "golang.org/x/net/http2"
)
func push(res http.ResponseWriter, req *http.Request, pt func() interface{}, data []byte) {
@@ -23,8 +24,12 @@ func push(res http.ResponseWriter, req *http.Request, pt func() interface{}, dat
for i := range values {
val := values[i]
val.ForEach(func(k, v gjson.Result) bool {
+ if v.String() == "null" {
+ return true
+ }
+
err := pusher.Push(v.String(), nil)
- if err != nil {
+ if err != nil && err != http2.ErrRecursivePush {
log.Println("Error during Push of value:", v.String())
}