Skip to content

Commit

Permalink
Better warn instead of throwing error
Browse files Browse the repository at this point in the history
  • Loading branch information
Seefaaa committed Jan 5, 2025
1 parent f2702b2 commit 7b29533
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/byond/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub enum Error {
UnexpectedType(Response),
#[error("failed to parse param: {0} {1}")]
ParseParam(&'static str, String),
#[allow(dead_code)]
#[error("unknown param: {0}")]
UnknownParam(String),
}
5 changes: 4 additions & 1 deletion src/byond/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ pub async fn status(address: &str) -> super::Result<ServerStatus> {
"interviews" => status.interviews = value == "1",
"shuttle_mode" => status.shuttle_mode = value.parse()?,
"shuttle_timer" => status.shuttle_timer = value.parse()?,
_ => return Err(Error::UnknownParam(key.to_string())),
_ => {
#[cfg(debug_assertions)]
tracing::warn!("Status topic responsed with unknown param: {key} = {value} ({address})");
}
}
}

Expand Down

0 comments on commit 7b29533

Please sign in to comment.