1#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
5pub enum PgJsonlError {
6 #[error("PG-JSONL: line {line}: {detail}")]
8 Json {
9 line: usize,
11 detail: String,
13 },
14
15 #[error("PG-JSONL: line {line}: unknown record type '{kind}'")]
17 UnknownType {
18 line: usize,
20 kind: String,
22 },
23
24 #[error("PG-JSONL: line {line}: '{field}' must not be empty")]
26 EmptyField {
27 line: usize,
29 field: &'static str,
31 },
32}
33
34#[cfg(test)]
35mod tests {
36 use super::*;
37
38 #[test]
39 fn display_unknown_type() {
40 let err = PgJsonlError::UnknownType {
41 line: 3,
42 kind: "vertex".to_owned(),
43 };
44 assert_eq!(
45 err.to_string(),
46 "PG-JSONL: line 3: unknown record type 'vertex'"
47 );
48 }
49}