path_offset/
error.rs

1use lyon::extra::parser::ParseError;
2use thiserror::Error;
3
4pub type Result<T, E = PathError> = std::result::Result<T, E>;
5
6/// Represents all possible errors that can occur within the new_path module.
7#[derive(Error, Debug)]
8pub enum PathError {
9    /// An error occurred while parsing an SVG path data string.
10    /// This variant automatically converts from `lyon::extra::parser::ParseError`.
11    #[error("Failed to parse SVG path data: {0}")]
12    Parse(#[from] ParseError),
13
14    #[error("Failed to fit curve")]
15    FitCurve,
16
17    #[error("Failed to clean path")]
18    CleanPath,
19
20    /// (推荐添加) An I/O error occurred.
21    /// Useful if you ever read paths from files.
22    #[error("I/O error: {0}")]
23    Io(#[from] std::io::Error),
24}