pub enum Error {
Empty,
MissingMsh,
BadMshHeader(String),
Path(String),
NoSuchSegment {
name: String,
occurrence: usize,
},
UnwritablePath(String),
MissingField {
path: String,
},
BadValue {
path: String,
expected: String,
found: String,
},
Dictionary(Error),
Invalid(Vec<Diagnostic>),
}Expand description
What can go wrong.
Reading is deliberately lenient below the MSH header: unknown segments,
unknown data types, and structure mismatches are never errors — they
degrade to positional names and a flat reading, and are reported by
Message::validate if the caller wants to know. Only a message with
no usable header, a path that is not a path, a dictionary that will not
load, and (in struct mode) a value that does not fit its Rust type will
fail a call.
Variants§
Empty
Input contained no segments.
MissingMsh
The first segment is not MSH, so the message never declared its delimiters.
BadMshHeader(String)
The MSH header is malformed: no delimiters, or an unusable set.
Path(String)
A path such as PID-5.1 could not be read; carries the reason.
NoSuchSegment
A write named a segment the message does not have. Add it with
Message::append_segment or build the message with Builder.
UnwritablePath(String)
A write named something that cannot be written — a whole segment, or a repeating value without a field.
MissingField
Struct mode: a non-optional field’s path names nothing in the message.
BadValue
Struct mode: a value is present but does not fit the Rust type.
Fields
Dictionary(Error)
A dictionary could not be loaded; see dictionary::Error.
Invalid(Vec<Diagnostic>)
Options::strict was set and the message did not pass
validation. Carries every Severity::Error diagnostic.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
1.30.0 · 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()