From 1243bf29d5f8ea816abcad977c43d5aae993a1d7 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 13 Jul 2021 15:32:57 +0100 Subject: [PATCH] errors: Abolish alias OE for Fatal Signed-off-by: Ian Jackson --- daemon/api.rs | 6 +++--- daemon/main.rs | 2 +- daemon/session.rs | 2 +- src/global.rs | 6 +++--- src/prelude.rs | 1 - src/sse.rs | 2 +- src/updates.rs | 6 +++--- 7 files changed, 12 insertions(+), 13 deletions(-) diff --git a/daemon/api.rs b/daemon/api.rs index ebf9f03d..ee04ab66 100644 --- a/daemon/api.rs +++ b/daemon/api.rs @@ -15,7 +15,7 @@ pub struct InstanceAccess<'i, Id> { } impl<'r, Id> FromFormValue<'r> for InstanceAccess<'r, Id> - where Id: AccessId, OE: From + where Id: AccessId, Fatal: From { type Error = OER; #[throws(OER)] @@ -93,7 +93,7 @@ impl<'r> Responder<'r> for FatalErrorResponse { } } -#[throws(OE)] +#[throws(Fatal)] fn api_piece_op(form: Json>) -> impl response::Responder<'static> { // thread::sleep(Duration::from_millis(2000)); @@ -194,7 +194,7 @@ fn api_piece_op(form: Json>) prepub.finish(); } - Ok::<(),OE>(()) + Ok::<(),Fatal>(()) })(); let g = &mut *ig; diff --git a/daemon/main.rs b/daemon/main.rs index 5c20e1af..61fe654a 100644 --- a/daemon/main.rs +++ b/daemon/main.rs @@ -111,7 +111,7 @@ fn loading_l(layout: Parse, ia: PlayerQueryString) loading(Some((layout.0).0), ia)? } -#[throws(OE)] +#[throws(Fatal)] fn loading(layout: Option, ia: PlayerQueryString) -> Template { diff --git a/daemon/session.rs b/daemon/session.rs index e1606da6..8cb0b6a7 100644 --- a/daemon/session.rs +++ b/daemon/session.rs @@ -89,7 +89,7 @@ impl SvgAttrs { fn session_inner(form: Json, layout: Option) - -> Result { + -> Result { // make session in this game, log a message to other players let iad = lookup_token(form.ptoken.borrow())?; let player = iad.ident; diff --git a/src/global.rs b/src/global.rs index f135d538..31d99f42 100644 --- a/src/global.rs +++ b/src/global.rs @@ -598,9 +598,9 @@ impl From<&LinksTable> for Html { // ---------- Player and token functionality ---------- impl InstanceAccessDetails - where Id: AccessId, OE: From + where Id: AccessId, Fatal: From { - #[throws(OE)] + #[throws(Fatal)] pub fn from_token(token: &RawTokenVal) -> InstanceAccessDetails { let g = Id::global_tokens(PRIVATE_Y).read(); let i = g.get(token).ok_or(Id::ERROR)?; @@ -1350,7 +1350,7 @@ pub fn lookup_token(s: &RawTokenVal) .ok_or(Id::ERROR) } -#[throws(OE)] +#[throws(Fatal)] pub fn record_token ( ig: &mut InstanceGuard, iad: InstanceAccessDetails diff --git a/src/prelude.rs b/src/prelude.rs index 83b6d9a1..bd6ef8cb 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -196,7 +196,6 @@ pub type PUM = ProgressUpdateMode; pub type APOE = ApiPieceOpError; pub type ESVU = ErrorSignaledViaUpdate; pub type IE = InternalError; -pub type OE = Fatal; // xxx get rid of this alyas when we've cleaned up Fatal pub type Ia = Inapplicable; pub type POEPP = PieceOpErrorPartiallyProcessed; pub type SvgE = SVGProcessingError; diff --git a/src/sse.rs b/src/sse.rs index b939d7ea..9f897444 100644 --- a/src/sse.rs +++ b/src/sse.rs @@ -219,7 +219,7 @@ impl StableIndexOffset for UpdateId { // ---------- entrypoint for dribbling the http response ---------- -#[throws(OE)] +#[throws(Fatal)] pub fn content(iad: InstanceAccessDetails, gen: Generation) -> impl Read { let client = iad.ident; diff --git a/src/updates.rs b/src/updates.rs index 5a9a80ff..b01ed922 100644 --- a/src/updates.rs +++ b/src/updates.rs @@ -284,7 +284,7 @@ struct FormattedLogEntry<'u> { // ---------- helpful utilities ---------- -#[throws(OE)] +#[throws(Fatal)] pub fn log_did_to_piece_whoby(ioccults: &IOccults, goccults: &GameOccults, by_gpl: &GPlayer, gpc: &GPiece, ipc: &IPiece, did: &str) @@ -311,7 +311,7 @@ pub fn log_did_to_piece_whoby(ioccults: &IOccults, goccults: &GameOccults, (log, Some(who_by)) } -#[throws(OE)] +#[throws(Fatal)] pub fn log_did_to_piece(ioccults: &IOccults, goccults: &GameOccults, by_gpl: &GPlayer, gpc: &GPiece, ipc: &IPiece, did: &str) @@ -615,7 +615,7 @@ impl<'r> PrepareUpdatesBuffer<'r> { logents: Vec, partially: PieceOpErrorPartiallyProcessed, client: ClientId, cseq: ClientSequence) - -> Result<(),OE> { + -> Result<(),Fatal> { let by_client = (WRC::Unpredictable, client, cseq); let mut buf = PrepareUpdatesBuffer::new(ig, None); let ops = PUOs::Simple(PieceUpdateOp::Modify(())); -- 2.30.2