| 688 | |
| 689 | impl From<IndexError> for ContentSearchError { |
| 690 | fn from(err: IndexError) -> Self { |
| 691 | match err { |
| 692 | IndexError::Io(ref e) if e.kind() == std::io::ErrorKind::NotFound => { |
| 693 | ContentSearchError::IndexNotFound |
| 694 | } |
| 695 | IndexError::IndexNotFound(_) => ContentSearchError::IndexNotFound, |
| 696 | IndexError::InvalidPattern(p) => ContentSearchError::InvalidPattern(p), |
| 697 | IndexError::CorruptIndex(msg) => ContentSearchError::CorruptIndex(msg), |
| 698 | IndexError::LockConflict(_) => ContentSearchError::LockConflict, |
| 699 | other => ContentSearchError::Index(other.to_string()), |
| 700 | } |
| 701 | } |
| 702 | } |
| 703 | |
| 704 | #[cfg(test)] |