[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[robocop] branch master updated: more logging, harsher error handling
From: |
Admin |
Subject: |
[robocop] branch master updated: more logging, harsher error handling |
Date: |
Sun, 08 Jun 2025 23:11:30 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository robocop.
The following commit(s) were added to refs/heads/master by this push:
new 67ccfc9 more logging, harsher error handling
67ccfc9 is described below
commit 67ccfc97e548203686af985b8115d110d14bf30f
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Jun 8 23:11:24 2025 +0200
more logging, harsher error handling
---
src/main.rs | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/main.rs b/src/main.rs
index 901cc04..c6ef2ce 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -18,7 +18,7 @@
use std::collections::HashMap;
use std::env;
use std::fs;
-use std::io::{self, BufRead, BufReader};
+use std::io::{self, Write, BufRead, BufReader};
use serde_json::{Value, Map};
// Finite State Machine for efficient string matching
@@ -258,20 +258,24 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
for line in reader.lines() {
let line = line?;
if line.trim().is_empty() {
- continue;
+ eprintln!("ERROR: empty input line");
+ std::process::exit(1);
}
match serde_json::from_str::<Value>(&line) {
Ok(Value::Object(obj)) => {
+ eprintln!("INFO: robocop received input: {}", line);
let (quality, confidence, ssid) = engine.find_best_match(&obj);
println!("{:.6} {:.6} {}", quality, confidence, ssid);
+ // Not 100% clear if flush is needed here, but safer.
+ io::stdout().flush().unwrap();
}
Ok(_) => {
- eprintln!("Warning: Skipping non-object JSON: {}", line);
+ eprintln!("ERROR: non-object JSON received: {}", line);
std::process::exit(1);
}
Err(e) => {
- eprintln!("Warning: Failed to parse JSON: {} - {}", line, e);
+ eprintln!("ERROR: Failed to parse JSON: {} - {}", line, e);
std::process::exit(1);
}
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [robocop] branch master updated: more logging, harsher error handling,
Admin <=