use thiserror::Error;
#[derive(Debug, Error)]
pub enum EzError {
#[error("Failed to initialize renderer: {0}\n\nSuggestion: Check that Vulkan is installed and your GPU drivers are up to date.")]
InitializationFailed(String),
#[error("Shader compilation failed: {0}\n\nSuggestion: Check your GLSL syntax. Line numbers are shown above.")]
ShaderCompilationFailed(String),
#[error("Pipeline creation failed: {0}\n\nSuggestion: Ensure shaders are compatible and all required attachments are specified.")]
PipelineCreationFailed(String),
#[error("Invalid shader stages: {0}\n\nSuggestion: Graphics pipelines need at least a vertex shader. Fragment shaders are optional but recommended.")]
InvalidShaderStages(String),
#[error("Frame rendering failed: {0}\n\nSuggestion: Ensure device is not lost. Check for validation layer messages.")]
FrameFailed(String),
#[error("Runtime error: {0}")]
RuntimeError(String),
}
impl From<crate::ex::RuntimeError> for EzError {
fn from(err: crate::ex::RuntimeError) -> Self {
EzError::RuntimeError(err.to_string())
}
}
impl From<crate::ex::ShaderManagerError> for EzError {
fn from(err: crate::ex::ShaderManagerError) -> Self {
EzError::ShaderCompilationFailed(err.to_string())
}
}
impl From<crate::core::ShaderError> for EzError {
fn from(err: crate::core::ShaderError) -> Self {
EzError::ShaderCompilationFailed(err.to_string())
}
}
impl From<crate::core::PipelineError> for EzError {
fn from(err: crate::core::PipelineError) -> Self {
EzError::PipelineCreationFailed(err.to_string())
}
}