1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use std::{io, string::FromUtf8Error};

use thiserror::Error;

use crate::text_splitter::TextSplitterError;

#[derive(Error, Debug)]
pub enum LoaderError {
    #[error("Error loading document: {0}")]
    LoadDocumentError(String),

    #[error("{0}")]
    TextSplitterError(#[from] TextSplitterError),

    #[error(transparent)]
    IOError(#[from] io::Error),

    #[error(transparent)]
    FromUtf8Error(#[from] FromUtf8Error),

    #[error(transparent)]
    CSVError(#[from] csv::Error),

    #[cfg(any(feature = "lopdf"))]
    #[error(transparent)]
    LoPdfError(#[from] lopdf::Error),

    #[cfg(feature = "pdf-extract")]
    #[error(transparent)]
    PdfExtractError(#[from] pdf_extract::Error),

    #[cfg(feature = "pdf-extract")]
    #[error(transparent)]
    PdfExtractOutputError(#[from] pdf_extract::OutputError),

    #[error(transparent)]
    ReadabilityError(#[from] readability::error::Error),

    #[error(transparent)]
    JoinError(#[from] tokio::task::JoinError),

    #[cfg(feature = "git")]
    #[error(transparent)]
    DiscoveryError(#[from] gix::discover::Error),

    #[error("Error: {0}")]
    OtherError(String),
}