use std::{
error::Error,
fmt::{Display, Formatter},
};
#[derive(Debug)]
pub enum PlaySoundError<E> {
SoundLimitReached,
IntoSoundError(E),
}
impl<E> Display for PlaySoundError<E> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
PlaySoundError::SoundLimitReached => f.write_str(
"Could not play a sound because the maximum number of sounds has been reached.",
),
PlaySoundError::IntoSoundError(_) => {
f.write_str("An error occurred when initializing the sound.")
}
}
}
}
impl<E: std::fmt::Debug> Error for PlaySoundError<E> {}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ResourceLimitReached;
impl Display for ResourceLimitReached {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(
"Could not add a resource because the maximum capacity for that resource has been reached",
)
}
}
impl Error for ResourceLimitReached {}