From 81746dd5dc4041c1187b1b5a04c6529829a8a309 Mon Sep 17 00:00:00 2001 From: Emile Date: Sun, 11 Jul 2021 00:32:44 +0100 Subject: [PATCH] Added non-panic error handling for the sink --- src/main.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 59aff7b..9d2df03 100644 --- a/src/main.rs +++ b/src/main.rs @@ -130,11 +130,18 @@ async fn main() -> Result<(), Box> { .map_err(|e| Box::new(e) as Box); tokio::spawn(async move { - sender - .sink_map_err(|e| Box::new(e) as Box) - .send_all(&mut model) - .await - .expect("Broken buffer"); + loop { + if let Err(err) = sender + .clone() // Does this even make sense??? Can you clone a sender?? am i fucked now?? + // shouldnt it be re-init'd? + .sink_map_err(|e| Box::new(e) as Box) + .send_all(&mut model) + .await + { + // Idk what to do here, remake stream? what? idk, im not rustie + println!("got error on sender stream: {}", err); + } + } }); publisher