diff --git a/lib/cartodb/middleware/rate-limit.js b/lib/cartodb/middleware/rate-limit.js index db6556e1..c864a821 100644 --- a/lib/cartodb/middleware/rate-limit.js +++ b/lib/cartodb/middleware/rate-limit.js @@ -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); } diff --git a/test/acceptance/rate-limit.test.js b/test/acceptance/rate-limit.test.js index 2c154107..339e187e 100644 --- a/test/acceptance/rate-limit.test.js +++ b/test/acceptance/rate-limit.test.js @@ -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) {