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

encoding/json: json.Unmarshaler errors ignored #7123

Closed
eaigner opened this issue Jan 14, 2014 · 4 comments
Closed

encoding/json: json.Unmarshaler errors ignored #7123

eaigner opened this issue Jan 14, 2014 · 4 comments

Comments

@eaigner
Copy link
Contributor

eaigner commented Jan 14, 2014

Run the following example:

    http://play.golang.org/p/GC9MRwj2NN

Although an error is returned, the JSON parser just stops parsing and inserts a 0 value
instead.
The error is never returned by `json.Unmarshal` itself.
@eaigner
Copy link
Contributor Author

eaigner commented Jan 14, 2014

Comment 1:

$ go version
go version go1.2 darwin/amd64

@cespare
Copy link
Contributor

cespare commented Jan 15, 2014

Comment 2:

You're not actually checking the Unmarshal error; only the MarshalIndent one.
Your custom error is correctly returned:
http://play.golang.org/p/CgiHfypUtQ

@eaigner
Copy link
Contributor Author

eaigner commented Jan 15, 2014

Comment 3:

That's true, my oversight.

@bradfitz
Copy link
Contributor

Comment 4:

Status changed to Retracted.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants