From ddf7c12c4927d8696c641d9f72b1fef94e046f77 Mon Sep 17 00:00:00 2001 From: troido Date: Fri, 25 Sep 2020 16:19:05 +0200 Subject: encyclopedia now using serde serialisation too --- src/worldloader.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/worldloader.rs') diff --git a/src/worldloader.rs b/src/worldloader.rs index 414d443..c8738e2 100644 --- a/src/worldloader.rs +++ b/src/worldloader.rs @@ -60,15 +60,14 @@ impl WorldLoader { pub fn load_encyclopedia(&self, name: &str) -> Result { let fname: String = name.to_string() + ".json"; - let encyclopedia = Encyclopedia::from_json( + let encyclopedia: Encyclopedia = serde_json::from_str( &fs::read_to_string( self.directory .join("encyclopediae") .join(&fname) )? - )? - )?; + ).map_err(|e|aerr!("failed to load encyclopedia {}: {}", name, e))?; encyclopedia.validate()?; Ok(encyclopedia) } -- cgit