mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-06-21 08:55:16 +00:00
Make limit system lives
This commit is contained in:
@ -146,6 +146,13 @@ impl HttpRequestHandler {
|
||||
Err(Box::new(ExecError::new(&message)))
|
||||
}
|
||||
|
||||
/// Too many requests (429)
|
||||
pub fn too_many_requests(&mut self, message: &str) -> RequestResult {
|
||||
self.response = Some(HttpResponse::TooManyRequests().json(
|
||||
HttpError::new(429, message)));
|
||||
Err(Box::new(ExecError::new(message)))
|
||||
}
|
||||
|
||||
/// If result is not OK, return a bad request
|
||||
pub fn ok_or_bad_request<E>(&mut self, res: ResultBoxError<E>, msg: &str) -> ResultBoxError<E> {
|
||||
match res {
|
||||
|
Reference in New Issue
Block a user