Made MTTError a proper Error structure.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s

This commit is contained in:
2026-02-12 22:49:19 -05:00
parent 7ff9ca340f
commit a9b87200ef
12 changed files with 156 additions and 164 deletions

View File

@@ -1,6 +1,6 @@
use morethantext::{
action::{DocDef, FieldType, Query},
MTTError, MoreThanText, Name,
ErrorID, MTTError, MoreThanText, Name,
};
use uuid::Uuid;
@@ -10,10 +10,13 @@ fn errors_on_missing_page() {
let doc_name = "missing";
match mtt.get_document(doc_name, "something") {
Ok(data) => assert!(false, "got '{}', should have been not found error", data),
Err(err) => match err {
MTTError::DocumentNotFound(result) => assert_eq!(result, doc_name),
_ => unreachable!("got {:?}, should have been not found", err),
},
Err(err) => {
let err_id = err.error_id();
match err_id {
ErrorID::DocumentNotFound => {}
_ => unreachable!("got {:?}, should have been not found", err),
}
}
}
}