Skip to content

Commit

Permalink
Raise error when services file does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
cofob committed Aug 4, 2024
1 parent 257458a commit 663a59c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fastside/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ async fn main() -> Result<()> {
let data_path = services
.clone()
.unwrap_or_else(|| PathBuf::from_str("services.json").unwrap());
if !data_path.is_file() {
return Err(anyhow::anyhow!(
"services file does not exist or is not a file"
));
}
let data_content =
std::fs::read_to_string(data_path).context("failed to read services file")?;
let stored_data: StoredData =
Expand Down

0 comments on commit 663a59c

Please sign in to comment.