The smokesignal.events web application
at main 56 lines 2.3 kB view raw
1use thiserror::Error; 2 3/// Represents errors that can occur during profile index operations. 4/// 5/// These errors typically occur when interacting with OpenSearch 6/// during the profile indexing process. 7#[derive(Debug, Error)] 8pub(crate) enum ProfileIndexError { 9 /// Error when OpenSearch index creation fails. 10 /// 11 /// This error occurs when attempting to create an OpenSearch index 12 /// and the operation fails with a server error response. 13 #[error("error-smokesignal-profile-index-1 Failed to create index: {error_body}")] 14 IndexCreationFailed { error_body: String }, 15 16 /// Error when OpenSearch index deletion fails. 17 /// 18 /// This error occurs when attempting to delete an OpenSearch index 19 /// and the operation fails with a server error response. 20 #[error("error-smokesignal-profile-index-2 Failed to delete index: {error_body}")] 21 IndexDeletionFailed { error_body: String }, 22 23 /// Error when listing indexed profiles fails. 24 /// 25 /// This error occurs when the search query to list all profiles 26 /// returns a non-success status code. 27 #[error("error-smokesignal-profile-index-3 Failed to list indexed profiles")] 28 ListProfilesFailed, 29 30 /// Error when searching indexed profiles fails. 31 /// 32 /// This error occurs when the search query returns a non-success status code. 33 #[error("error-smokesignal-profile-index-4 Search query failed")] 34 SearchFailed, 35 36 /// Error when deleting an indexed profile fails. 37 /// 38 /// This error occurs when attempting to delete a profile from the index 39 /// and the operation fails with a non-success status code. 40 #[error("error-smokesignal-profile-index-5 Failed to delete indexed profile")] 41 DeleteProfileFailed, 42 43 /// Error when indexing a profile fails. 44 /// 45 /// This error occurs when attempting to add or update a profile in the index 46 /// and the operation fails with a server error response. 47 #[error("error-smokesignal-profile-index-6 Failed to index profile")] 48 IndexProfileFailed, 49 50 /// Error when search response format is invalid. 51 /// 52 /// This error occurs when the OpenSearch response doesn't contain 53 /// the expected structure (e.g., missing hits array). 54 #[error("error-smokesignal-profile-index-7 Invalid search response format")] 55 InvalidSearchResponse, 56}