synwire_core/vfs/
error.rs1use std::io;
4use thiserror::Error;
5
6#[derive(Error, Debug)]
8#[non_exhaustive]
9pub enum VfsError {
10 #[error("Not found: {0}")]
12 NotFound(String),
13
14 #[error("Permission denied: {0}")]
16 PermissionDenied(String),
17
18 #[error("Is a directory: {0}")]
20 IsDirectory(String),
21
22 #[error("Path traversal blocked: attempted {attempted}, root {root}")]
24 PathTraversal {
25 attempted: String,
27 root: String,
29 },
30
31 #[error("Scope violation: path {path} outside scope {scope}")]
33 ScopeViolation {
34 path: String,
36 scope: String,
38 },
39
40 #[error("Resource limit: {0}")]
42 ResourceLimit(String),
43
44 #[error("Timeout: {0}")]
46 Timeout(String),
47
48 #[error("Operation denied: {0}")]
50 OperationDenied(String),
51
52 #[error(
54 "Stale read: {path} was modified externally since it was last read. Re-read the file before editing."
55 )]
56 StaleRead {
57 path: String,
59 },
60
61 #[error("Not read: {path} must be read before editing or writing. Read the file first.")]
63 NotRead {
64 path: String,
66 },
67
68 #[error("Index denied: {reason}")]
70 IndexDenied {
71 reason: String,
73 },
74
75 #[error("Index not ready: {0}")]
77 IndexNotReady(String),
78
79 #[error("Unsupported: {0}")]
81 Unsupported(String),
82
83 #[error("I/O error: {0}")]
85 Io(#[from] io::Error),
86}