pub enum Error {
Meta(Error),
Structure(String),
NotFound(PathBuf),
AlreadyExists(PathBuf),
Io(Error),
Content(String),
MarkdownStore(PathBuf),
Escape(PathBuf),
StaleJournal(PathBuf),
Torn {
cause: String,
rollback: String,
},
Collision(Collision),
}Expand description
Errors produced by prov.
Variants§
Meta(Error)
The embedded-metadata backend (fig) failed to parse or serialize.
Structure(String)
A structural invariant was violated (e.g. malformed frontmatter fence).
NotFound(PathBuf)
A document a workspace operation names is not on disk — the typed form of
the many “X does not exist” guards the mutation ops make before touching a
document (reparent, rename, duplicate, register, …). A caller can
tell a genuinely-missing target from a malformed one by matching the
variant, rather than sniffing the message text.
AlreadyExists(PathBuf)
A workspace operation would create a document where one already exists, and
refused rather than overwrite it — the typed form of the “X already exists”
guards in create/rename/attach. A destination collision is a distinct
outcome from a missing source, and now distinguishable as one.
Io(Error)
The storage backend failed.
Content(String)
The twig body parser failed — see content.rs.
MarkdownStore(PathBuf)
A record store — the id registry, the recycle-bin index, or a flat
vocabulary — was found in a markdown carrier (fenced frontmatter)
rather than a whole-file config document (.yaml/.json/.figl). prov
imposes a sorted, one-record-per-line layout on these stores (DESIGN §5),
so a prose carrier has no stable home for its records and is refused. Make
it a bare config file. See crate::document::require_whole_file.
Escape(PathBuf)
A path handed to a workspace read or write resolved outside the
workspace root — an absolute path, or one that climbs above the root with
... prov clamps every I/O to the tree it was pointed at (a link
target is data, and data must never be able to name /etc/passwd or a
sibling repo), so such a path is refused rather than followed. See
crate::link::escapes_root, the guard at prov’s Workspace’s load
and prov’s ChangeSet::apply.
StaleJournal(PathBuf)
A prov’s ChangeSet was applied while a previous change’s
write-ahead journal was still on disk — an earlier mutation was
interrupted (a crash) and never recovered. Landing this set would
overwrite that journal and lose the record needed to complete the
interrupted change, so the apply refuses: run recovery
(prov’s journal::recover, which prov check performs) first, then
retry.
Torn
A staged write failed and the rollback that should have undone it also
failed — see prov’s ChangeSet::apply. The one case where
prov cannot say what is on disk, so it says exactly that instead of
reporting the original failure as if the workspace were untouched.
Fields
Collision(Collision)
An operation would have registered an ID across a registration the index
already holds — see Collision. Refused rather
than resolved, because the displaced document still spells the ID in its
own frontmatter and only its author can say which one should keep it.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()