Remove redundant error mapping (#1593)

Helpful regex error in Find&Replace was obscured by generic
"Invalid input" error.
This commit is contained in:
RumovZ 2022-01-16 04:46:27 +01:00 committed by GitHub
parent 9936f6f7d1
commit 77b1546583
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,7 +7,7 @@ use regex::Regex;
use crate::{
collection::Collection,
error::{AnkiError, Result},
error::Result,
notes::{NoteId, TransformNoteOutput},
prelude::*,
text::normalize_to_nfc,
@ -35,7 +35,7 @@ impl FindReplaceContext {
) -> Result<Self> {
Ok(FindReplaceContext {
nids,
search: Regex::new(search_re).map_err(|_| AnkiError::invalid_input("invalid regex"))?,
search: Regex::new(search_re)?,
replacement: repl.into(),
field_name,
})