Skip to content

json decoding should fail with a more descriptive error #4244

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

Closed
erickt opened this issue Dec 21, 2012 · 5 comments · Fixed by #10625
Closed

json decoding should fail with a more descriptive error #4244

erickt opened this issue Dec 21, 2012 · 5 comments · Fixed by #10625
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@erickt
Copy link
Contributor

erickt commented Dec 21, 2012

Right now decoding will do a fail ~"not a list" if it tries to deserialize the wrong type. We should give some hints as to the type of the value it found.

@catamorphism
Copy link
Contributor

Seems non-critical for 0.7. Nominating for milestone 3 (feature complete).

@graydon
Copy link
Contributor

graydon commented May 2, 2013

declined, noncritical

@msullivan
Copy link
Contributor

Still there, still not critical.

@metajack
Copy link
Contributor

visiting for triage. I'm not sure exactly how to reproduce this but the fail! code is still present. It's in read_seq.

@huonw
Copy link
Member

huonw commented Nov 23, 2013

Triage: reproduced by

#[feature(managed_boxes)];

extern mod extra;
use extra::serialize::Decodable;
use extra::json;

#[deriving(Decodable)]
struct Foo {
    x: ~[Foo]
}

fn main() {
    let mut x = json::Decoder(json::from_str(r#"{"x": 1}"#).unwrap());
    let _: Foo = Decodable::decode(&mut x);
}

I'm going through extra::json with a goal to improve most of these error messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants