refactor: Improve filter parsing and error handling
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat>
This commit is contained in:
@@ -7,6 +7,8 @@ use serde_json;
|
|||||||
#[grammar = "filter.pest"]
|
#[grammar = "filter.pest"]
|
||||||
pub struct FilterParser;
|
pub struct FilterParser;
|
||||||
|
|
||||||
|
use crate::Rule;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Filter {
|
pub struct Filter {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
@@ -65,7 +67,7 @@ pub fn parse_filter_string(input: &str) -> Result<Vec<Filter>, Box<dyn std::erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn parse_option_value(input: &str) -> Result<serde_json::Value, Box<dyn std::error::Error>> {
|
fn parse_option_value(input: &str) -> Result<serde_json::Value, Box<dyn std::error::Error>> {
|
||||||
serde_json::from_str(input).map_err(|e| Box::new(e) as Box<dyn std::error::Error + Send + Sync + 'static>)
|
serde_json::from_str(input).map_err(|e| Box::new(e) as Box<dyn std::error::Error>)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
Reference in New Issue
Block a user