pub enum StreamError {
Io(Error),
Utf8 {
line: usize,
message: String,
},
Syntax {
line: usize,
message: String,
},
Schema {
line: usize,
message: String,
},
Header(String),
MissingVersion,
InvalidVersion(String),
OrphanRow {
line: usize,
message: String,
},
ShapeMismatch {
line: usize,
expected: usize,
got: usize,
},
Timeout {
elapsed: Duration,
limit: Duration,
},
LineTooLong {
line: usize,
length: usize,
limit: usize,
},
InvalidUtf8 {
line: usize,
error: Utf8Error,
},
}Expand description
Errors that can occur during streaming parsing.
All variants include contextual information to help diagnose and fix issues.
Most errors include line numbers; use the line() method to
extract them uniformly.
§Examples
§Creating Errors
use hedl_stream::StreamError;
let err = StreamError::syntax(42, "unexpected token");
assert_eq!(err.line(), Some(42));
let schema_err = StreamError::schema(10, "type not found");
assert_eq!(schema_err.line(), Some(10));§Error Display
use hedl_stream::StreamError;
let err = StreamError::syntax(5, "missing colon");
let msg = format!("{}", err);
assert!(msg.contains("line 5"));
assert!(msg.contains("missing colon"));Variants§
Io(Error)
IO error.
Utf8
Invalid UTF-8 encoding.
Fields
Syntax
Syntax error.
Fields
Schema
Schema error.
Fields
Header(String)
Invalid header.
MissingVersion
Missing version directive.
InvalidVersion(String)
Invalid version.
OrphanRow
Orphan row (child without parent).
Fields
ShapeMismatch
Shape mismatch.
Fields
Timeout
Timeout exceeded during parsing.
LineTooLong
Line length exceeds configured maximum.
Fields
InvalidUtf8
Invalid UTF-8 encoding in input.
Implementations§
Source§impl StreamError
impl StreamError
Sourcepub fn orphan_row(line: usize, message: impl Into<String>) -> Self
pub fn orphan_row(line: usize, message: impl Into<String>) -> Self
Create an orphan row error.
Trait Implementations§
Source§impl Debug for StreamError
impl Debug for StreamError
Source§impl Display for StreamError
impl Display for StreamError
Source§impl Error for StreamError
impl Error for StreamError
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 StreamError
impl !RefUnwindSafe for StreamError
impl Send for StreamError
impl Sync for StreamError
impl Unpin for StreamError
impl !UnwindSafe for StreamError
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