langchain_rust/text_splitter/
error.rs1use text_splitter::ChunkConfigError;
2use thiserror::Error;
3
4#[derive(Error, Debug)]
5#[non_exhaustive]
6pub enum TextSplitterError {
7 #[error("Empty input text")]
8 EmptyInputText,
9
10 #[error("Mismatch metadata and text")]
11 MetadataTextMismatch,
12
13 #[error("Tokenizer not found")]
14 TokenizerNotFound,
15
16 #[error("Tokenizer creation failed due to invalid tokenizer")]
17 InvalidTokenizer,
18
19 #[error("Tokenizer creation failed due to invalid model")]
20 InvalidModel,
21
22 #[error("Invalid chunk overlap and size")]
23 InvalidSplitterOptions,
24
25 #[error("Error: {0}")]
26 OtherError(String),
27}
28
29impl From<ChunkConfigError> for TextSplitterError {
30 fn from(_: ChunkConfigError) -> Self {
31 Self::InvalidSplitterOptions
32 }
33}