Skip to main content

Error

Enum Error 

Source
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,
    },
    Drifted(PathBuf),
    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

An apply could not deliver either of its durable answers — see prov’s ChangeSet::apply. The classic case: a staged write failed and the rollback that should have undone it also failed. Since fs-transaction 0.2 the same shape also covers a rollback or a completed apply whose certification (or journal retirement) could not be made durable. In every case prov cannot stand behind a clean endpoint, so it says exactly that instead of reporting the original failure as if the workspace were untouched — and prov check’s recovery is what resolves the workspace to a nameable state.

Fields

§cause: String

The failure that triggered the rollback.

§rollback: String

The failure the rollback itself hit.

§

Drifted(PathBuf)

A mutation’s reading of the workspace went stale before its writes landed: between an op computing its edits and applying them, something else — another process, a sync daemon — wrote to this path. The op stages what it read as an expectation on its prov’s ChangeSet (ChangeSet::expect / expect_absent), and the apply refuses the whole set rather than land edits computed from a reading that no longer holds: nothing was written, journaled, or unwound. Unlike AlreadyExists (the same fact caught while computing), this is retryable as-is — re-run the operation and it recomputes over the fresh state.

§

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 Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for Error

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Collision> for Error

Source§

fn from(collision: Collision) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Carry a transaction failure into prov’s own error vocabulary.

fs_transaction phrases its errors for a generic tree of files, since it knows nothing about workspaces. The variants map one-to-one onto prov’s, which restate them in terms a prov user can act on — naming prov check as the recovery step, and a workspace root as the boundary that was crossed.

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !UnwindSafe for Error

§

impl Freeze for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.