From 7ce51b15814837e686447c2eb366b0d521748877 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Wed, 14 Aug 2019 15:22:00 -0400 Subject: [PATCH] Add errorMessage --- lib/src/rate_limiter.dart | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/src/rate_limiter.dart b/lib/src/rate_limiter.dart index a14af9f9..75d4b99a 100644 --- a/lib/src/rate_limiter.dart +++ b/lib/src/rate_limiter.dart @@ -18,7 +18,15 @@ abstract class RateLimiter { /// more than [maxPointsPerWindow]. final Duration windowDuration; - RateLimiter(this.maxPointsPerWindow, this.windowDuration); + /// The error message to send to a [User] who has exceeded the + /// rate limit during the current window. + /// + /// This only applies to the default implementation of + /// [denyRequest]. + final String errorMessage; + + RateLimiter(this.maxPointsPerWindow, this.windowDuration, + {this.errorMessage}); /// Computes the current window in which the user is acting. ///