pub enum IngestError {
Io {
path: PathBuf,
source: Error,
},
Parse {
path: Option<PathBuf>,
source: Error,
},
NotATrace {
path: Option<PathBuf>,
source: Error,
},
JsonLines {
path: Option<PathBuf>,
},
}Expand description
Everything that can go wrong loading a trace. The library path returns this rather than panicking.
The parse family carries an optional path because amberfork diff reads two inputs — an
error that doesn’t say which file broke is a dead end. load_file fills it in;
from_json_str has no path to give (embedded demo pair, future stdin).
Variants§
Io
The file could not be read.
Parse
The input was not parseable JSON. The canonical loader reserves this for malformed
JSON — shape problems classify as Self::NotATrace — while the format adapters
(tape, whowhen) use it for any serde failure on their foreign shapes.
NotATrace
Valid JSON, but not shaped like a canonical trace (issue #20). The serde detail names the field or variant that broke; the display adds what a trace needs and points to the format reference so the first error is not a dead end.
JsonLines
The input looks like JSON-Lines — the shape of a raw exporter transcript, the likeliest first mistake (issue #20). amberfork takes a single JSON trace per file; the display points to the conversion guide.
Implementations§
Source§impl IngestError
impl IngestError
Sourcepub fn with_path(self, path: &Path) -> Self
pub fn with_path(self, path: &Path) -> Self
Attach the originating file to a parse-family error — load_file knows the path,
from_json_str doesn’t. Io already names its file. Public because a caller that reads
the bytes itself (the CLI’s format-sniffing loader) still wants the file attributed.
Trait Implementations§
Source§impl Debug for IngestError
impl Debug for IngestError
Source§impl Display for IngestError
impl Display for IngestError
Source§impl Error for IngestError
impl Error for IngestError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()