langchain_rust/document_loaders/
error.rs

1use std::{io, string::FromUtf8Error};
2
3use thiserror::Error;
4
5use crate::text_splitter::TextSplitterError;
6
7#[derive(Error, Debug)]
8pub enum LoaderError {
9    #[error("Error loading document: {0}")]
10    LoadDocumentError(String),
11
12    #[error("{0}")]
13    TextSplitterError(#[from] TextSplitterError),
14
15    #[error(transparent)]
16    IOError(#[from] io::Error),
17
18    #[error(transparent)]
19    FromUtf8Error(#[from] FromUtf8Error),
20
21    #[error(transparent)]
22    CSVError(#[from] csv::Error),
23
24    #[cfg(any(feature = "lopdf"))]
25    #[error(transparent)]
26    LoPdfError(#[from] lopdf::Error),
27
28    #[cfg(feature = "pdf-extract")]
29    #[error(transparent)]
30    PdfExtractError(#[from] pdf_extract::Error),
31
32    #[cfg(feature = "pdf-extract")]
33    #[error(transparent)]
34    PdfExtractOutputError(#[from] pdf_extract::OutputError),
35
36    #[error(transparent)]
37    ReadabilityError(#[from] readability::error::Error),
38
39    #[error(transparent)]
40    JoinError(#[from] tokio::task::JoinError),
41
42    #[cfg(feature = "git")]
43    #[error(transparent)]
44    DiscoveryError(#[from] gix::discover::Error),
45
46    #[error("Error: {0}")]
47    OtherError(String),
48}