json_objects_to_csv/
error.rs

1use std::fs::File;
2use std::io::BufWriter;
3use thiserror::Error;
4
5/// Errors that can happen while using this crate.
6#[derive(Error, Debug)]
7pub enum Error {
8    #[error("Flattening the JSON failed: {0}")]
9    Flattening(#[from] flatten_json_object::Error),
10
11    #[error(
12        "Two objects have keys that should be different but end looking the same after flattening"
13    )]
14    FlattenedKeysCollision,
15
16    #[error("Writting a CSV record failed: {0}")]
17    WrittingCSV(#[from] csv::Error),
18
19    #[error("Parsing JSON failed: {0}")]
20    ParsingJson(#[from] serde_json::Error),
21
22    #[error("Input/output error: {0}")]
23    InputOutput(#[from] std::io::Error),
24
25    #[error("Could not extract the inner file from a BufWriter: {0}")]
26    IntoFile(#[from] std::io::IntoInnerError<BufWriter<File>>),
27}