time_passed,
rate_limit.allowance
);
- let error = LemmyError::from(anyhow::anyhow!(
- "Too many requests. type: {}, IP: {}, {} per {} seconds",
- type_.as_ref(),
- ip,
- rate,
- per
- ));
- Err(error.with_message("too_many_requests"))
+ Err(LemmyError::from_error_message(
+ anyhow::anyhow!(
+ "Too many requests. type: {}, IP: {}, {} per {} seconds",
+ type_.as_ref(),
+ ip,
+ rate,
+ per
+ ),
+ "too_many_requests",
+ ))
} else {
if !check_only {
rate_limit.allowance -= 1.0;