mirror of
https://codeberg.org/icewind/log-normalizer.git
synced 2026-06-03 13:54:11 +02:00
log info about invalid logs
This commit is contained in:
parent
d1d0a24aa3
commit
8055e54974
1 changed files with 4 additions and 1 deletions
|
|
@ -134,9 +134,11 @@ async fn get_log(pool: &PgPool, id: i32) -> Result<Option<NormalizedLog>, Error>
|
|||
|
||||
fn is_valid(value: &serde_json::Value) -> bool {
|
||||
if value.get("success").is_none() {
|
||||
info!("missing 'success'");
|
||||
return false;
|
||||
}
|
||||
if !value.get("success").unwrap().as_bool().unwrap_or_default() {
|
||||
info!("'success' is false");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -145,8 +147,9 @@ fn is_valid(value: &serde_json::Value) -> bool {
|
|||
.or_else(|| value.get("info").map(|info| info.get("rounds")).unwrap())
|
||||
.unwrap();
|
||||
|
||||
for round in rounds.as_array().unwrap() {
|
||||
for (index, round) in rounds.as_array().unwrap().iter().enumerate() {
|
||||
if round.get("length").unwrap().as_i64().unwrap() < 0 {
|
||||
info!(round = index, "round has invalid length");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue