#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
pub enum PgJsonlError {
#[error("PG-JSONL: line {line}: {detail}")]
Json {
line: usize,
detail: String,
},
#[error("PG-JSONL: line {line}: unknown record type '{kind}'")]
UnknownType {
line: usize,
kind: String,
},
#[error("PG-JSONL: line {line}: '{field}' must not be empty")]
EmptyField {
line: usize,
field: &'static str,
},
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn display_unknown_type() {
let err = PgJsonlError::UnknownType {
line: 3,
kind: "vertex".to_owned(),
};
assert_eq!(
err.to_string(),
"PG-JSONL: line 3: unknown record type 'vertex'"
);
}
}