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