bug: made the regex error one line in search
This commit is contained in:
parent
39d7450aad
commit
0986b96056
|
@ -205,6 +205,8 @@ impl ProcWidgetState {
|
|||
self.process_search_state.search_state.error_message = None;
|
||||
} else {
|
||||
let parsed_query = self.parse_query();
|
||||
// debug!("PQ: {:?}", parsed_query);
|
||||
|
||||
if let Ok(parsed_query) = parsed_query {
|
||||
self.process_search_state.search_state.query = Some(parsed_query);
|
||||
self.process_search_state.search_state.is_blank_search = false;
|
||||
|
|
|
@ -104,6 +104,16 @@ impl From<std::str::Utf8Error> for BottomError {
|
|||
|
||||
impl From<regex::Error> for BottomError {
|
||||
fn from(err: regex::Error) -> Self {
|
||||
BottomError::QueryError(err.to_string().into())
|
||||
// We only really want the last part of it... so we'll do it the ugly way:
|
||||
let err_str = err.to_string();
|
||||
let error = err_str.split('\n').map(|s| s.trim()).collect::<Vec<_>>();
|
||||
|
||||
BottomError::QueryError(
|
||||
format!(
|
||||
"Regex error: {}",
|
||||
error.last().unwrap_or(&"".to_string().as_str())
|
||||
)
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue