pub enum LedgerError {
UnregisteredEvent {
name: String,
file: String,
known: String,
},
MissingField {
name: String,
field: String,
},
Vocabulary {
path: String,
reason: String,
},
Io {
path: String,
reason: String,
},
}Expand description
What can go wrong writing or reading the ledger. The first two are refusals of a malformed event and happen before anything is written; the last two are the disk.
use majordomus_cli::session::{Envelope, LedgerError, LedgerEvent, Vocabulary};
let v = Vocabulary::parse("version: 1\nevents:\n - id: session.started\n requires: [owner]\n public: true\n").unwrap();
let envelope = Envelope {
ts: "2026-09-11T11:02:35Z".into(), head: "1a651e64".into(),
branch: "master".into(), by: "majordomus/0.5.0".into(), session: None,
};
let err = LedgerEvent::new("session.started").render(&v, &envelope).expect_err("a refusal");
assert!(matches!(err, LedgerError::MissingField { .. }));Variants§
UnregisteredEvent
The event name is not one share/events.yaml declares. An internal error and not a
finding: a command that writes an event the vocabulary does not define is a bug in
Majordomus, not a fact about the repository being supervised.
Fields
MissingField
The event is declared and the payload is missing a key its declaration requires.
Vocabulary
The vocabulary file could not be read or does not parse.
Io
The ledger file itself could not be opened, locked or written.
Trait Implementations§
Source§impl Debug for LedgerError
impl Debug for LedgerError
Source§impl Display for LedgerError
impl Display for LedgerError
Source§impl Error for LedgerError
impl Error for LedgerError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for LedgerError
impl RefUnwindSafe for LedgerError
impl Send for LedgerError
impl Sync for LedgerError
impl Unpin for LedgerError
impl UnsafeUnpin for LedgerError
impl UnwindSafe for LedgerError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more