suggest: Rename `SuggestError` to `SuggestApiError`.
This commit is contained in:
Родитель
2c08a5ece4
Коммит
8f9299e17d
|
@ -18,12 +18,12 @@ pub enum Error {
|
|||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum SuggestError {
|
||||
pub enum SuggestApiError {
|
||||
#[error("Other error: {reason}")]
|
||||
Other { reason: String },
|
||||
}
|
||||
|
||||
impl From<Error> for SuggestError {
|
||||
impl From<Error> for SuggestApiError {
|
||||
fn from(error: Error) -> Self {
|
||||
Self::Other {
|
||||
reason: error.to_string(),
|
||||
|
|
|
@ -5,7 +5,7 @@ mod schema;
|
|||
|
||||
use serde_derive::*;
|
||||
|
||||
pub use error::SuggestError;
|
||||
pub use error::SuggestApiError;
|
||||
pub use provider::{IngestLimits, SuggestionProvider};
|
||||
|
||||
pub type Result<T, E = error::Error> = std::result::Result<T, E>;
|
||||
|
|
|
@ -9,7 +9,7 @@ use serde_derive::*;
|
|||
|
||||
use crate::{
|
||||
db::{ConnectionType, SuggestDb, LAST_FETCH_META_KEY},
|
||||
error::SuggestError,
|
||||
error::SuggestApiError,
|
||||
RemoteRecordId, RemoteSuggestion, Result, Suggestion,
|
||||
};
|
||||
|
||||
|
@ -53,7 +53,7 @@ pub struct IngestLimits {
|
|||
|
||||
impl SuggestionProvider {
|
||||
/// Creates a suggestion provider.
|
||||
pub fn new(path: &str) -> Result<Self, SuggestError> {
|
||||
pub fn new(path: &str) -> Result<Self, SuggestApiError> {
|
||||
Ok(Self::new_inner(path)?)
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ impl SuggestionProvider {
|
|||
}
|
||||
|
||||
/// Queries the database for suggestions that match the `keyword`.
|
||||
pub fn query(&self, keyword: &str) -> Result<Vec<Suggestion>, SuggestError> {
|
||||
pub fn query(&self, keyword: &str) -> Result<Vec<Suggestion>, SuggestApiError> {
|
||||
Ok(self.dbs()?.reader.fetch_by_keyword(keyword)?)
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ impl SuggestionProvider {
|
|||
|
||||
/// Ingests new suggestions from Remote Settings. `limits` can be used to
|
||||
/// constrain the amount of work done.
|
||||
pub fn ingest(&self, limits: &IngestLimits) -> Result<(), SuggestError> {
|
||||
pub fn ingest(&self, limits: &IngestLimits) -> Result<(), SuggestApiError> {
|
||||
Ok(self.ingest_inner(limits)?)
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ namespace suggest {
|
|||
};
|
||||
|
||||
[Error]
|
||||
interface SuggestError {
|
||||
interface SuggestApiError {
|
||||
Other(string reason);
|
||||
};
|
||||
|
||||
|
@ -25,14 +25,14 @@ dictionary Suggestion {
|
|||
};
|
||||
|
||||
interface SuggestionProvider {
|
||||
[Throws=SuggestError]
|
||||
[Throws=SuggestApiError]
|
||||
constructor([ByRef] string path);
|
||||
|
||||
[Throws=SuggestError]
|
||||
[Throws=SuggestApiError]
|
||||
sequence<Suggestion> query([ByRef] string keyword);
|
||||
|
||||
void interrupt();
|
||||
|
||||
[Throws=SuggestError]
|
||||
[Throws=SuggestApiError]
|
||||
void ingest([ByRef] IngestLimits limits);
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче