1use core::fmt;
4
5#[derive(Clone, Copy, Debug, Eq, PartialEq)]
7pub enum CoreError {
8 NonFinite,
10 InsufficientCapacity,
12 InvalidThreshold,
14 InsufficientScratch,
16 InvalidMediaTime,
18}
19
20impl fmt::Display for CoreError {
21 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
22 f.write_str(match self {
23 Self::NonFinite => "non-finite numeric value",
24 Self::InsufficientCapacity => "insufficient capacity",
25 Self::InvalidThreshold => "invalid threshold",
26 Self::InsufficientScratch => "insufficient NMS scratch",
27 Self::InvalidMediaTime => "invalid media time (zero timescale)",
28 })
29 }
30}
31
32#[cfg(feature = "std")]
33impl std::error::Error for CoreError {}
34
35#[derive(Clone, Copy, Debug, Eq, PartialEq)]
37pub enum GeometryError {
38 NonFinite,
40 InvertedBounds,
42 DegenerateSegment,
44 TooFewPoints,
46}
47
48impl fmt::Display for GeometryError {
49 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
50 f.write_str(match self {
51 Self::NonFinite => "non-finite geometry coordinate",
52 Self::InvertedBounds => "inverted rectangle bounds",
53 Self::DegenerateSegment => "degenerate line segment",
54 Self::TooFewPoints => "polygon has too few points",
55 })
56 }
57}
58
59#[cfg(feature = "std")]
60impl std::error::Error for GeometryError {}