diff options
| author | ache <ache@ache.one> | 2026-08-04 10:03:51 +0200 |
|---|---|---|
| committer | ache <ache@ache.one> | 2026-08-04 10:03:51 +0200 |
| commit | 3beb37c0b5e8ecb38e6b773e12ee8416972a44e1 (patch) | |
| tree | f710ee6f3afd4a2be1ecea08264f281a836c4f07 /src | |
| parent | Init commit (diff) | |
Quit on error (Network for example)
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs index cf24d9b..db0edf7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -73,11 +73,10 @@ async fn main() { states[id as usize] = State::Received { rtt: rrt, ttl }; } } - PingResult::NoPingErr { id, error } => { - // NOTE: Maybe we should quit, I don't know. - if (id as usize) < states.len() { - states[id as usize] = State::SendError; - } + PingResult::NoPingErr { id: _, ref error } => { + // FEAT: It should fail if states is empty and print a informative characters on the line otherwise + eprintln!("Error: {}", error); + std::process::exit(2); } } } |