From: Ian Jackson Date: Fri, 31 Jul 2020 21:43:21 +0000 (+0100) Subject: reorg error X-Git-Tag: otter-0.2.0~1217 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=1e1452d6b808be66a0b69ea5a2f319735205da6b;p=otter.git reorg error --- diff --git a/src/error.rs b/src/error.rs index 1ec7908c..a9d243fd 100644 --- a/src/error.rs +++ b/src/error.rs @@ -42,6 +42,12 @@ pub enum ServerFailure { MessagePackDecodeFail(#[from] rmp_serde::decode::Error), } +#[derive(Error,Debug,Serialize,Copy,Clone)] +pub enum ErrorSignaledViaUpdate { + RenderingError, +} +display_as_debug!{ErrorSignaledViaUpdate} + pub type StartupError = anyhow::Error; pub use OnlineError::{NoClient,NoPlayer}; diff --git a/src/updates.rs b/src/updates.rs index b33142d4..1dde1b61 100644 --- a/src/updates.rs +++ b/src/updates.rs @@ -33,7 +33,7 @@ pub enum PreparedUpdateEntry { op : PieceUpdateOp, }, Log (Arc), - RenderingError, + Error (ErrorSignaledViaUpdate), } #[derive(Debug,Serialize)] @@ -76,7 +76,7 @@ enum TransmitUpdateEntry<'u> { op : &'u PieceUpdateOp, }, Log (&'u LogEntry), - ServerUpdateGenerationError, + Error(ErrorSignaledViaUpdate), } // ========== implementation ========== @@ -113,10 +113,10 @@ impl PreparedUpdateEntry { }, Log(logent) => { logent.html.as_bytes().len() * 3 - } - RenderingError => { + }, + Error(_) => { 100 - } + }, } } } @@ -247,7 +247,7 @@ impl<'r> PrepareUpdatesBuffer<'r> { .unwrap_or_else(|e| { eprintln!("piece update error! piece={:?} lens={:?} error={:?}", piece, &lens, &e); - PreparedUpdateEntry::RenderingError + PreparedUpdateEntry::Error(ErrorSignaledViaUpdate::RenderingError) }); self.us.push(update); } @@ -297,8 +297,8 @@ impl PreparedUpdate { PreparedUpdateEntry::Log(logent) => { TransmitUpdateEntry::Log(&logent) }, - PreparedUpdateEntry::RenderingError => { - TransmitUpdateEntry::ServerUpdateGenerationError + &PreparedUpdateEntry::Error(e) => { + TransmitUpdateEntry::Error(e) } }; ents.push(ue);