adding type and subtype to rate limit error
This commit is contained in:
parent
bbedc5f41b
commit
cbfeb0158e
@ -45,6 +45,8 @@ function rateLimit(userLimitsApi, endpointGroup = null) {
|
||||
if (isBlocked) {
|
||||
const rateLimitError = new Error('You are over the limits.');
|
||||
rateLimitError.http_status = 429;
|
||||
rateLimitError.type = 'limit';
|
||||
rateLimitError.subtype = 'rate-limit';
|
||||
return next(rateLimitError);
|
||||
}
|
||||
|
||||
|
@ -133,6 +133,8 @@ function assertRateLimitRequest (status, limit, remaining, reset, retry, done =
|
||||
assert.ok(err);
|
||||
assert.equal(err.message, 'You are over the limits.');
|
||||
assert.equal(err.http_status, 429);
|
||||
assert.equal(err.type, 'limit');
|
||||
assert.equal(err.subtype, 'rate-limit');
|
||||
}
|
||||
|
||||
if (done) {
|
||||
|
Loading…
Reference in New Issue
Block a user