diff --git a/src/cli/commands/search.rs b/src/cli/commands/search.rs index a02ddb2..521bd92 100644 --- a/src/cli/commands/search.rs +++ b/src/cli/commands/search.rs @@ -345,7 +345,7 @@ fn collapse_newlines(s: &str) -> String { let mut result = String::with_capacity(s.len()); let mut prev_was_space = false; for c in s.chars() { - if c.is_ascii_whitespace() { + if c.is_whitespace() { if !prev_was_space { result.push(' '); prev_was_space = true; @@ -606,7 +606,13 @@ pub fn print_search_results_json( data: response, meta: SearchMeta { elapsed_ms }, }; - let mut value = serde_json::to_value(&output).unwrap(); + let mut value = match serde_json::to_value(&output) { + Ok(v) => v, + Err(e) => { + eprintln!("Error serializing search response: {e}"); + return; + } + }; if let Some(f) = fields { let expanded = crate::cli::robot::expand_fields_preset(f, "search"); crate::cli::robot::filter_fields(&mut value, "results", &expanded);