You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Yokii908 i've been using your approach, but wondering if there is a way to stop iteration on error? In my case, if I'm processing a large array and encounter an error, i would like to exit and return the error instead of continuing to iterate through a large array. Currently I do
varinnererrerror_, err:=jsonparser.ArrayEach(bytes, func(data []byte, _ jsonparser.ValueType, _int, _error) {
// exit early if an error has already occurredifinnererr!=nil {
return
}
// do heavy processing and set innererr if an error occursiferr:=doHeavyWork(data); err!=nil {
innererr=errreturn
}
}, "path", "to", "large", "array")
if there is a way to simply return the error and stop iteration, it's not obvious to me.
Reacted by Michael Ben-Nes, RH DÆMNT, Gabe Cook and Brian Shih
Is there a way for the callback to ArrayEach to return errors.