use std::fmt::{self, Display}; #[derive(Debug, Clone, PartialEq, Eq)] pub enum JumpHopError { MissingRunId, MissingProfileId, MissingOwnerUserId, EmptyPath, RunNotPlaying, NoNextPlatform, } impl Display for JumpHopError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let message = match self { Self::MissingRunId => "缺少 runId", Self::MissingProfileId => "缺少 profileId", Self::MissingOwnerUserId => "owner_user_id 缺失", Self::EmptyPath => "跳一跳路径为空", Self::RunNotPlaying => "当前运行态不是 playing", Self::NoNextPlatform => "没有下一块平台", }; write!(f, "{message}") } } impl std::error::Error for JumpHopError {}