diff options
| -rw-r--r-- | server/src/data.rs | 11 | 
1 files changed, 7 insertions, 4 deletions
| diff --git a/server/src/data.rs b/server/src/data.rs index e2944e3d..6b0442ce 100644 --- a/server/src/data.rs +++ b/server/src/data.rs @@ -19,7 +19,7 @@ use crate::{      interaction::Recipe,      protocol::{DemandIndex, ItemIndex, RecipeIndex, TileIndex},  }; -use anyhow::{anyhow, bail, Result}; +use anyhow::{anyhow, bail, Context, Result};  use glam::{IVec2, Vec2};  use serde::{Deserialize, Serialize};  use std::{ @@ -142,9 +142,12 @@ impl DataIndex {          let map_path = data_dir().join(format!("maps/{map}.yaml"));          let recipes_path = data_dir().join(format!("recipes/{recipes}.yaml")); -        let demands_in = serde_yaml::from_reader(File::open(demands_path).unwrap()).unwrap(); -        let map_in = serde_yaml::from_reader(File::open(map_path).unwrap()).unwrap(); -        let recipes_in = serde_yaml::from_reader(File::open(recipes_path).unwrap()).unwrap(); +        let demands_in = +            serde_yaml::from_reader(File::open(demands_path).context("opening demands failed")?)?; +        let map_in = serde_yaml::from_reader(File::open(map_path).context("opening map failed")?)?; +        let recipes_in = serde_yaml::from_reader( +            File::open(recipes_path).context("opening recipes failed. are they generated yet?")?, +        )?;          Ok(Gamedata::build(recipes_in, map_in, demands_in)?)      } | 
