aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-09-18 09:49:47 -0400
committerAlex Crichton <alex@alexcrichton.com>2014-09-18 09:49:47 -0400
commit5806d17e78c62df1e6c9fcfa13058729cc868332 (patch)
tree448fbe82ce914d6aa9273b1040ae8fc88056e55e
parent5f5bd93203aa4c8e0602eb4def2d73d385cba74c (diff)
parentef4e8f58acf6dcb3eae9ee26069b71837195a455 (diff)
downloadmilf-rs-5806d17e78c62df1e6c9fcfa13058729cc868332.tar.gz
milf-rs-5806d17e78c62df1e6c9fcfa13058729cc868332.zip
Merge pull request #18 from jroesch/failing-show
Update show to print an error instead of failing
-rw-r--r--src/show.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/show.rs b/src/show.rs
index b072277..a8a302e 100644
--- a/src/show.rs
+++ b/src/show.rs
@@ -36,8 +36,9 @@ impl fmt::Show for Value {
Datetime(ref s) => write!(f, "{}", s),
Array(ref a) => {
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)
}
@@ -166,4 +167,3 @@ mod tests {
test = \"wut\"\n")
}
}
-