#[cfg(feature = "img")]
use resvg::usvg::Error as UsvgError;
use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum VisGraphError {
#[error("Settings error: {0}")]
Settings(#[from] InvalidSettingsError),
#[cfg(feature = "img")]
#[error("SVG to Image conversion error: {0}")]
SvgToImage(#[from] SvgToImageError),
#[error("IO error: {0}")]
IO(#[from] std::io::Error),
}
#[derive(Debug, Error)]
#[cfg(feature = "img")]
pub enum SvgToImageError {
#[error("SVG parsing error: {0}")]
SVGParserError(#[from] UsvgError),
#[error("IO error: {0}")]
IOError(#[from] std::io::Error),
}
#[derive(Clone, Copy, Debug, Error, PartialEq)]
pub enum InvalidSettingsError {
#[error("Invalid dimensions: ({0}, {1}) must be positive values.")]
Dimensions(f32, f32),
#[error("Invalid radius: {0} must be a positive value.")]
Radius(f32),
#[error("Invalid font size: {0} must be a positive value.")]
FontSize(f32),
#[error("Invalid stroke width: {0} must be a positive value.")]
StrokeWidth(f32),
#[error("Invalid margins: ({0}, {1}) must lie in the range [0.0, 0.5).")]
Margin(f32, f32),
}