From 7e83c238553cda73e71df5714a539aa5601adbc0 Mon Sep 17 00:00:00 2001 From: rasul Date: Sun, 5 Apr 2020 16:20:28 -0500 Subject: [PATCH] improve logging and errors --- src/world/exit.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/world/exit.rs b/src/world/exit.rs index 6f759f5..9900965 100644 --- a/src/world/exit.rs +++ b/src/world/exit.rs @@ -22,8 +22,14 @@ impl<'a> TryFrom<&Row<'a>> for Exit { fn try_from(row: &Row) -> Result { Ok(Self { - target: row.get("target")?, - direction: Direction::try_from_long(row.get::<&str, String>("direction")?)?, + target: try_log!(row.get("target"), "Unable to get column 'target' from row"), + direction: try_log!( + Direction::try_from_long(try_log!( + row.get::<&str, String>("direction"), + "Unable to get column 'direction' from row" + )), + "Unable to parse direction" + ) }) } }