2
0
mirror of https://github.com/frappe/frappe.git synced 2024-06-03 02:50:49 +00:00

fix: correct HTTP response code for rate limit

This commit is contained in:
Ankush Menat 2024-04-08 18:13:34 +05:30
parent 491c995313
commit ea45d959b3
2 changed files with 3 additions and 2 deletions

View File

@ -122,7 +122,7 @@ class InvalidSignatureError(ValidationError):
class RateLimitExceededError(ValidationError):
pass
http_status_code = 429
class CannotChangeConstantError(ValidationError):

View File

@ -147,7 +147,8 @@ def rate_limit(
value = frappe.cache.incrby(cache_key, 1)
if value > _limit:
frappe.throw(
_("You hit the rate limit because of too many requests. Please try after sometime.")
_("You hit the rate limit because of too many requests. Please try after sometime."),
frappe.RateLimitExceededError,
)
return fn(*args, **kwargs)