use crate::{renderer::framework::error::FrameworkError, sound::error::SoundError};
#[derive(Debug, thiserror::Error)]
pub enum EngineError {
#[error(transparent)]
Sound(SoundError),
#[error(transparent)]
Renderer(FrameworkError),
#[error("Custom error: {0}")]
Custom(String),
}
impl From<SoundError> for EngineError {
fn from(sound: SoundError) -> Self {
Self::Sound(sound)
}
}
impl From<FrameworkError> for EngineError {
fn from(renderer: FrameworkError) -> Self {
Self::Renderer(renderer)
}
}
#[cfg(not(target_arch = "wasm32"))]
impl From<glutin::CreationError> for EngineError {
fn from(e: glutin::CreationError) -> Self {
Self::Custom(format!("{:?}", e))
}
}
#[cfg(not(target_arch = "wasm32"))]
impl From<glutin::ContextError> for EngineError {
fn from(e: glutin::ContextError) -> Self {
Self::Custom(format!("{:?}", e))
}
}