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