sim_expr_tree_core/error.rs
1use crate::{CellId, DirId, GeneratedNameKind, NamespaceName};
2
3/// Typed failures for backend-neutral expression-tree namespace records.
4#[derive(Clone, Debug, PartialEq, Eq)]
5pub enum NamespaceError {
6 /// An id constructor received empty text.
7 EmptyId {
8 /// The id family being constructed.
9 kind: &'static str,
10 },
11 /// A child name is not legal as a canonical Table path segment.
12 IllegalName(String),
13 /// A parent directory is unknown to this namespace.
14 MissingDir(DirId),
15 /// A cell is unknown to this namespace.
16 MissingCell(CellId),
17 /// A directory is unknown to this namespace.
18 MissingDirRecord(DirId),
19 /// A child name is already occupied under the parent directory.
20 NameCollision {
21 /// The parent directory containing the conflicting name.
22 parent: DirId,
23 /// The conflicting child name.
24 name: NamespaceName,
25 },
26 /// A cell record cannot be created without a durable name reservation.
27 MissingReservation {
28 /// The parent directory for the requested create.
29 parent: DirId,
30 /// The child name that was not reserved.
31 name: NamespaceName,
32 },
33 /// A recovered generated-name counter is behind durable namespace state.
34 CounterCorruption {
35 /// The parent directory whose counter is corrupt.
36 parent: DirId,
37 /// The generated-name family whose counter is corrupt.
38 kind: GeneratedNameKind,
39 /// The occupied candidate produced by the corrupt counter.
40 candidate: NamespaceName,
41 },
42 /// Another writer lane is already active.
43 WriterAlreadyActive,
44 /// The caller supplied no valid writer lane.
45 InvalidWriterLane,
46 /// The root directory cannot be renamed or moved.
47 RootDirCannotMove,
48 /// A directory cannot be moved below itself.
49 DirMoveCycle {
50 /// The directory being moved.
51 dir: DirId,
52 /// The requested new parent.
53 new_parent: DirId,
54 },
55 /// A directory must be empty before it can be deleted.
56 DirNotEmpty(DirId),
57}