diff options
| author | troido <troido@protonmail.com> | 2020-09-25 16:19:05 +0200 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-09-25 16:19:05 +0200 |
| commit | ddf7c12c4927d8696c641d9f72b1fef94e046f77 (patch) | |
| tree | 7842fbef7f9ee43207fd8573e082e1a25e3e7658 /src/worldloader.rs | |
| parent | 87727f9519eb37b565d8cc88e174935bac0e1d12 (diff) | |
encyclopedia now using serde serialisation too
Diffstat (limited to 'src/worldloader.rs')
| -rw-r--r-- | src/worldloader.rs | 5 |
1 files changed, 2 insertions, 3 deletions
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<Encyclopedia> { 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) } |
