Merge pull request #18 from jroesch/failing-show
Update show to print an error instead of failing
This commit is contained in:
commit
5806d17e78
|
@ -36,8 +36,9 @@ impl fmt::Show for Value {
|
||||||
Datetime(ref s) => write!(f, "{}", s),
|
Datetime(ref s) => write!(f, "{}", s),
|
||||||
Array(ref a) => {
|
Array(ref a) => {
|
||||||
match a.as_slice().head() {
|
match a.as_slice().head() {
|
||||||
Some(&Table(..)) => fail!("invalid toml array of tables"),
|
Some(&Table(..)) =>
|
||||||
_ => {}
|
try!(write!(f, "invalid toml array of tables")),
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
write!(f, "{}", a)
|
write!(f, "{}", a)
|
||||||
}
|
}
|
||||||
|
@ -166,4 +167,3 @@ mod tests {
|
||||||
test = \"wut\"\n")
|
test = \"wut\"\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue