use std::path::PathBuf;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("Addon directory not found: {0}")]
AddonNotFound(PathBuf),
#[error("Failed to parse data.lua: {0}")]
DataLuaParse(String),
#[error("Entry not found: {0}")]
EntryNotFound(uuid::Uuid),
#[error("Duplicate key '{key}' for type '{type}' (existing ID: {existing_id})")]
DuplicateKey {
r#type: crate::MediaType,
key: String,
existing_id: uuid::Uuid,
},
#[error("Unsupported file format for type '{target_type}': {extension}")]
UnsupportedFormat {
target_type: crate::MediaType,
extension: String,
},
#[error("Invalid image file: {0}")]
InvalidImage(String),
#[error("Image dimensions must be positive, got {width}x{height}")]
InvalidDimensions {
width: u32,
height: u32,
},
#[error("Image too large (max {max}x{max}): {actual}x{actual}")]
ImageTooLarge {
max: u32,
actual: u32,
},
#[error("Invalid font file: {0}")]
InvalidFont(String),
#[error("Invalid locale configuration: {0}")]
InvalidLocale(String),
#[error("Invalid audio file: {0}")]
InvalidAudio(String),
#[error("File too large: {actual} bytes (max {max} bytes)")]
FileTooLarge {
path: PathBuf,
actual: u64,
max: u64,
},
#[error("Failed to convert image: {0}")]
ImageConversion(String),
#[error("Failed to convert audio: {0}")]
AudioConversion(String),
#[error("I/O error on {path}: {source}")]
Io {
#[source]
source: std::io::Error,
path: PathBuf,
},
#[error("Lua error: {0}")]
Lua(#[from] mlua::Error),
}