pub fn check_slurs(text: &str, slur_regex: &Option<Regex>) -> Result<(), LemmyError> {
if let Err(slurs) = slur_check(text, slur_regex) {
- let error = LemmyError::from(anyhow::anyhow!("{}", slurs_vec_to_str(slurs)));
- Err(error.with_message("slurs"))
+ Err(LemmyError::from_error_message(
+ anyhow::anyhow!("{}", slurs_vec_to_str(slurs)),
+ "slurs",
+ ))
} else {
Ok(())
}