You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#[derive(Debug)]pubenumUpdateObjectError{SliceTooSmall,SliceToVanjectParse(VanjectError),PlayerNotFound(ClientID),VanjectNotFound(i32),PlayerNotBind(ClientID),}impl fmt::DisplayforUpdateObjectError{fnfmt(&self,f:&mut fmt::Formatter<'_>) -> fmt::Result{matchself{Self::SliceTooSmall => write!(f, "fail read slice as vanject: [too small slice]"),Self::SliceToVanjectParse(e) => write!(f, "fail read slice as vanject: [{}]", e),Self::PlayerNotFound(id) => write!(f, "player with `client_id`={} not found", id),Self::VanjectNotFound(id) => write!(f, "vanject with `id`={} not found", id),Self::PlayerNotBind(id) => write!(f, "player with `client_id`={} not bind", id),}}}implFrom<UpdateObjectError>forOnUpdateError{fnfrom(from:UpdateObjectError) -> Self{Self::UpdateObjectError(from)}}
would turn into
#[derive(Debug, thiserror::Error)]pubenumUpdateObjectError{#[error("fail read slice as vanject: [too small slice]")]SliceTooSmall,#[error("fail read slice as vanject")]SliceToVanjectParse(#[from]VanjectError),#[error("player with `client_id`={0} not found")]PlayerNotFound(ClientID),#[error("vanject with `id`={0} not found")]VanjectNotFound(i32),#[error("player with `client_id`={0} not bind")]PlayerNotBind(ClientID),}
The text was updated successfully, but these errors were encountered:
kvark
changed the title
Consider thiserror for errors
Consider thiserror for errors
Feb 23, 2021
For example, this code:
would turn into
The text was updated successfully, but these errors were encountered: