Skip to main content

Module error

Module error 

Source
Expand description

Typed public error model for endringer (RFC 006).

§Overview

All public methods on crate::backend::VcsBackend and on the endringer::repository::Repository façade return endringer_core::Result<T> (equivalently endringer::Result<T>).

The error type is #[non_exhaustive]: new variants may be added in minor releases without a new breaking wave. Consumers must include a wildcard arm when matching.

§Matching errors

Match on variants rather than on Display strings:

use endringer::{Error, NotFoundKind};

match repo.find_commit(&id) {
    Ok(info) => { /* … */ }
    Err(Error::NotFound { kind: NotFoundKind::Commit, name }) => {
        eprintln!("commit {name} not found");
    }
    Err(err) => return Err(err),
}

Enums§

Error
The public error type for all endringer operations.
NotFoundKind
The kind of named object that was not found.

Functions§

anyhow_to_backend
Convert an anyhow::Error into a Backend variant.

Type Aliases§

Result
Convenience alias for std::result::Result<T, endringer_core::Error>.