x12_stream_parser/
errors.rs1use std::fmt;
2
3#[derive(Debug, PartialEq, Eq, Clone, Copy)]
4pub enum ParserError {
5 UnterminatedSegment,
6 SegmentIdNotFound,
7}
8
9impl fmt::Display for ParserError {
10 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
11 match self {
12 ParserError::UnterminatedSegment => {
13 write!(f, "Input ended before a segment terminator was found")
14 }
15 ParserError::SegmentIdNotFound => {
16 write!(f, "Could not determine segment ID (segment empty or missing element separator?)")
17 }
18 }
19 }
20}
21
22impl std::error::Error for ParserError {}