24 lines
654 B
Rust
24 lines
654 B
Rust
use std::fmt::{self, Display};
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
pub enum WoodenFishError {
|
|
MissingRunId,
|
|
MissingProfileId,
|
|
MissingOwnerUserId,
|
|
RunNotPlaying,
|
|
}
|
|
|
|
impl Display for WoodenFishError {
|
|
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::RunNotPlaying => "当前运行态不是 playing",
|
|
};
|
|
write!(f, "{message}")
|
|
}
|
|
}
|
|
|
|
impl std::error::Error for WoodenFishError {}
|