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 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

This comment has been minimized.

Copy link
Contributor Author

@eaigner eaigner commented Jan 14, 2014

Comment 1:

$ go version
go version go1.2 darwin/amd64
@cespare

This comment has been minimized.

Copy link
Contributor

@cespare 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

This comment has been minimized.

Copy link
Contributor Author

@eaigner eaigner commented Jan 15, 2014

Comment 3:

That's true, my oversight.
@bradfitz

This comment has been minimized.

Copy link
Contributor

@bradfitz bradfitz commented Jan 15, 2014

Comment 4:

Status changed to Retracted.

@eaigner eaigner added the retracted label Jan 15, 2014
@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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.