dotloom_document/
error.rs1use thiserror::Error;
2
3use crate::{ConstraintId, EntityId, GroupId, LayerId};
4
5#[derive(Debug, Clone, PartialEq, Error)]
7#[non_exhaustive]
8pub enum DocError {
9 #[error("invalid type id `{0}`")]
11 InvalidTypeId(String),
12 #[error("duplicate id {0}")]
14 DuplicateId(String),
15 #[error("unknown entity {0}")]
17 UnknownEntity(EntityId),
18 #[error("unknown constraint {0}")]
20 UnknownConstraint(ConstraintId),
21 #[error("unknown layer {0}")]
23 UnknownLayer(LayerId),
24 #[error("unknown group {0}")]
26 UnknownGroup(GroupId),
27 #[error("{from} references missing {target}")]
29 BrokenReference {
30 from: String,
32 target: String,
34 },
35 #[error("entity {entity} has no anchor `{anchor}`")]
37 MissingAnchor {
38 entity: EntityId,
40 anchor: String,
42 },
43 #[error("entity {entity} has no numeric parameter `{param}`")]
45 MissingParam {
46 entity: EntityId,
48 param: String,
50 },
51 #[error("group cycle through {0}")]
53 GroupCycle(GroupId),
54 #[error("{0} is a member of more than one group")]
56 MultipleParents(String),
57 #[error("entity order is inconsistent: {0}")]
59 BadOrder(String),
60 #[error("invalid geometry for {entity}: {reason}")]
62 InvalidGeometry {
63 entity: EntityId,
65 reason: String,
67 },
68 #[error("invalid value: {0}")]
70 InvalidValue(String),
71 #[error("limit exceeded: {0}")]
73 LimitExceeded(String),
74 #[error("document schema {found} is newer than supported schema {supported}; upgrade Dotloom to open it")]
76 FutureSchema {
77 found: u32,
79 supported: u32,
81 },
82 #[error("document schema {0} is not supported")]
84 UnsupportedSchema(u32),
85 #[error("malformed document: {0}")]
87 Malformed(String),
88}