You've already forked AstralRinth
forked from didirus/AstralRinth
Fix plugin validator, fix version urls, clippy lints, additional categories (#421)
This commit is contained in:
@@ -8,6 +8,7 @@ use meilisearch_sdk::document::Document;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::borrow::Cow;
|
||||
use std::cmp::min;
|
||||
use std::fmt::Write;
|
||||
use thiserror::Error;
|
||||
|
||||
pub mod indexing;
|
||||
@@ -20,6 +21,8 @@ pub enum SearchError {
|
||||
Serde(#[from] serde_json::Error),
|
||||
#[error("Error while parsing an integer: {0}")]
|
||||
IntParsing(#[from] std::num::ParseIntError),
|
||||
#[error("Error while formatting strings: {0}")]
|
||||
FormatError(#[from] std::fmt::Error),
|
||||
#[error("Environment Error")]
|
||||
Env(#[from] dotenv::Error),
|
||||
#[error("Invalid index to sort by: {0}")]
|
||||
@@ -34,6 +37,7 @@ impl actix_web::ResponseError for SearchError {
|
||||
SearchError::Serde(..) => StatusCode::BAD_REQUEST,
|
||||
SearchError::IntParsing(..) => StatusCode::BAD_REQUEST,
|
||||
SearchError::InvalidIndex(..) => StatusCode::BAD_REQUEST,
|
||||
SearchError::FormatError(..) => StatusCode::BAD_REQUEST,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +49,7 @@ impl actix_web::ResponseError for SearchError {
|
||||
SearchError::Serde(..) => "invalid_input",
|
||||
SearchError::IntParsing(..) => "invalid_input",
|
||||
SearchError::InvalidIndex(..) => "invalid_input",
|
||||
SearchError::FormatError(..) => "invalid_input",
|
||||
},
|
||||
description: &self.to_string(),
|
||||
})
|
||||
@@ -215,7 +220,7 @@ pub async fn search_for_project(
|
||||
filter_string.push(')');
|
||||
|
||||
if !filters.is_empty() {
|
||||
filter_string.push_str(&format!(" AND ({})", filter_string))
|
||||
write!(filter_string, " AND ({})", filters)?;
|
||||
}
|
||||
} else {
|
||||
filter_string.push_str(&*filters);
|
||||
|
||||
Reference in New Issue
Block a user