generated from ElnuDev/rust-project
use thiserror
This commit is contained in:
parent
9009ae9e24
commit
2c72d5fc15
16 changed files with 104 additions and 163 deletions
|
@ -6,8 +6,8 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
err-derive = "0.3.1"
|
||||
lazy_static = "1.4.0"
|
||||
regex = "1.9.3"
|
||||
strum = "0.25.0"
|
||||
strum_macros = "0.25.2"
|
||||
thiserror = "1.0.47"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use super::SVGUnit;
|
||||
use err_derive::Error;
|
||||
use lazy_static::lazy_static;
|
||||
use regex::Regex;
|
||||
use thiserror::Error;
|
||||
use std::cmp::Ordering;
|
||||
use std::fmt;
|
||||
use std::num::ParseFloatError;
|
||||
|
@ -35,13 +35,13 @@ impl SVGMeasure {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
#[derive(Error, Debug)]
|
||||
pub enum SVGMeasureParseError {
|
||||
#[error(display = "Failed to parse measure number")]
|
||||
ParseMeasure(#[source] ParseFloatError),
|
||||
#[error(display = "Failed to parse measure unit")]
|
||||
ParseUnit(#[source] ParseError),
|
||||
#[error(display = "Invalid measure format")]
|
||||
#[error("Failed to parse measure number")]
|
||||
ParseMeasure(#[from] ParseFloatError),
|
||||
#[error("Failed to parse measure unit")]
|
||||
ParseUnit(#[from] ParseError),
|
||||
#[error("Invalid measure format")]
|
||||
Invalid,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue