Update show to print an error instead of failing

This commit is contained in:
Jared Roesch 2014-09-17 21:56:33 -07:00
parent 5f5bd93203
commit ef4e8f58ac

View file

@ -36,7 +36,8 @@ 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")
} }
} }