diff --git a/crates/git-op/src/error.rs b/crates/git-op/src/error.rs new file mode 100644 index 0000000..211ac6e --- /dev/null +++ b/crates/git-op/src/error.rs @@ -0,0 +1,18 @@ +//! Error types for the `git-op` crate. + +/// A wrapper type for generic [`gix::Error`] errors, and other error cases specific to [`git-op`]. +#[derive(Debug, thiserror::Error)] +#[non_exhaustive] +pub enum RepositoryStateError { + #[error(transparent)] + Git(#[from] gix::Error), + #[error("repository state tree has no `refs` entry")] + MissingRefs, + #[error("unexpected entry `{name}`")] + UnexpectedEntry { name: gix::bstr::BString }, + #[error("entry `{name}` has unexpected mode {mode:?}")] + UnexpectedMode { + name: gix::bstr::BString, + mode: gix::objs::tree::EntryMode, + }, +} diff --git a/crates/git-op/src/lib.rs b/crates/git-op/src/lib.rs index 089f0b1..819d880 100644 --- a/crates/git-op/src/lib.rs +++ b/crates/git-op/src/lib.rs @@ -1,3 +1,5 @@ +pub mod error; + #[cfg(test)] mod tests { #[test]