matrix_sdk_search/
error.rs1use tantivy::{
16 directory::error::OpenDirectoryError as TantivyOpenDirectoryError,
17 query::QueryParserError as TantivyQueryParserError,
18};
19use thiserror::Error;
20
21#[derive(Error, Debug)]
23pub enum IndexError {
24 #[error(transparent)]
26 TantivyError(tantivy::TantivyError),
27
28 #[error(transparent)]
30 OpenDirectoryError(TantivyOpenDirectoryError),
31
32 #[error(transparent)]
34 QueryParserError(TantivyQueryParserError),
35
36 #[error(transparent)]
38 IndexSchemaError(IndexSchemaError),
39
40 #[error(transparent)]
42 IndexWriteError(IndexWriteError),
43
44 #[error("Message type not supported")]
46 MessageTypeNotSupported,
47
48 #[error("Cannot index redacted message")]
50 CannotIndexRedactedMessage,
51
52 #[error("Cannot index empty message")]
54 EmptyMessage,
55
56 #[error(transparent)]
58 IO(std::io::Error),
59}
60
61impl From<tantivy::TantivyError> for IndexError {
62 fn from(err: tantivy::TantivyError) -> IndexError {
63 IndexError::TantivyError(err)
64 }
65}
66
67impl From<TantivyOpenDirectoryError> for IndexError {
68 fn from(err: TantivyOpenDirectoryError) -> IndexError {
69 IndexError::OpenDirectoryError(err)
70 }
71}
72
73impl From<TantivyQueryParserError> for IndexError {
74 fn from(err: TantivyQueryParserError) -> IndexError {
75 IndexError::QueryParserError(err)
76 }
77}
78
79impl From<IndexSchemaError> for IndexError {
80 fn from(err: IndexSchemaError) -> IndexError {
81 IndexError::IndexSchemaError(err)
82 }
83}
84
85impl From<IndexWriteError> for IndexError {
86 fn from(err: IndexWriteError) -> IndexError {
87 IndexError::IndexWriteError(err)
88 }
89}
90
91impl From<std::io::Error> for IndexError {
92 fn from(err: std::io::Error) -> IndexError {
93 IndexError::IO(err)
94 }
95}
96
97#[derive(Error, Debug)]
99pub enum IndexSchemaError {
100 #[error(transparent)]
102 TantivyError(tantivy::TantivyError),
103}
104
105impl From<tantivy::TantivyError> for IndexSchemaError {
106 fn from(err: tantivy::TantivyError) -> IndexSchemaError {
107 IndexSchemaError::TantivyError(err)
108 }
109}
110
111#[derive(Error, Debug)]
113pub enum IndexWriteError {
114 #[error(transparent)]
116 TantivyError(tantivy::TantivyError),
117}
118
119impl From<tantivy::TantivyError> for IndexWriteError {
120 fn from(err: tantivy::TantivyError) -> IndexWriteError {
121 IndexWriteError::TantivyError(err)
122 }
123}