Skip to main content

classify_materialize_error

Function classify_materialize_error 

Source
pub fn classify_materialize_error(err: Error) -> HeddleError
Expand description

Classify an anyhow error from a materialize/hydrate helper into the HeddleError the start transaction’s Result requires.

Mirrors CLI start_atomic::apply_error (heddle#571): must NOT blanket-wrap every failure as a Conflict. A plain I/O failure mid-materialize (e.g. clonefile/FICLONE ENOENT) must surface as Io so diagnosis and exit::from_error kind-keyed classification stay correct.

Recovery rules:

  • an already-structured HeddleError keeps its variant;
  • an error whose chain bottoms out in a std::io::Error becomes HeddleError::Io, preserving both the original ErrorKind and the full anyhow context ({err:#}) as the message;
  • only a genuinely-unclassifiable error falls back to HeddleError::Conflict.