1use std::path::PathBuf;
2use thiserror::Error;
3
4#[derive(Error, Debug)]
6pub enum NippyJarError {
7 #[error(transparent)]
9 Internal(#[from] Box<dyn core::error::Error + Send + Sync>),
10
11 #[error(transparent)]
13 Disconnect(#[from] std::io::Error),
14
15 #[error(transparent)]
17 FileSystem(#[from] reth_fs_util::FsPathError),
18
19 #[error("{0}")]
21 Custom(String),
22
23 #[error(transparent)]
25 Bincode(#[from] Box<bincode::ErrorKind>),
26
27 #[error(transparent)]
29 EliasFano(#[from] anyhow::Error),
30
31 #[error("compression was enabled, but it's not ready yet")]
33 CompressorNotReady,
34
35 #[error("decompression was enabled, but it's not ready yet")]
37 DecompressorNotReady,
38
39 #[error("number of columns does not match: {0} != {1}")]
41 ColumnLenMismatch(usize, usize),
42
43 #[error("unexpected missing value: row:col {0}:{1}")]
45 UnexpectedMissingValue(u64, u64),
46
47 #[error("the size of an offset must be at most 8 bytes, got {offset_size}")]
49 OffsetSizeTooBig {
50 offset_size: u8,
52 },
53
54 #[error("the size of an offset must be at least 1 byte, got {offset_size}")]
56 OffsetSizeTooSmall {
57 offset_size: u8,
59 },
60
61 #[error("attempted to read an out of bounds offset: {index}")]
63 OffsetOutOfBounds {
64 index: usize,
66 },
67
68 #[error("compression or decompression requires a bigger destination output")]
70 OutputTooSmall,
71
72 #[error("dictionary is not loaded.")]
74 DictionaryNotLoaded,
75
76 #[error("it's not possible to generate a compressor after loading a dictionary.")]
78 CompressorNotAllowed,
79
80 #[error("number of offsets ({0}) is smaller than prune request ({1}).")]
82 InvalidPruning(u64, u64),
83
84 #[error("jar has been frozen and cannot be modified.")]
86 FrozenJar,
87
88 #[error("File is in an inconsistent state.")]
90 InconsistentState,
91
92 #[error("Missing file: {}", .0.display())]
94 MissingFile(PathBuf),
95}