Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayEach can not return error #176

Open
dunixd opened this issue Sep 3, 2019 · 1 comment
Open

ArrayEach can not return error #176

dunixd opened this issue Sep 3, 2019 · 1 comment

Comments

@dunixd
Copy link

dunixd commented Sep 3, 2019

jsonparser/parser.go

Lines 943 to 957 in bf1c66b

if e != nil {
return offset, e
}
if o == 0 {
break
}
if t != NotExist {
cb(v, t, offset+o-len(v), e)
}
if e != nil {
break
}

how to indicate that cb return an error for ArrayEach, like ObjectEach do.

jsonparser/parser.go

Lines 1053 to 1060 in bf1c66b

// Step 3: find the associated value, then invoke the callback
if value, valueType, off, err := Get(data[offset:]); err != nil {
return err
} else if err := callback(key, value, valueType, offset+off); err != nil { // Invoke the callback here!
return err
} else {
offset += off
}

@stephane-moreau
Copy link

I had the same issue, willing to fail fast on some JSON parsing, I've put together a PR #214 feel free to comment and review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants