From 457a9859aa6205be2e98aaa168ece7e99d25b0e6 Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Tue, 8 Sep 2020 15:51:49 -0400 Subject: [PATCH] Add extensions support to hit rate limit exception --- api/src/exceptions/hit-rate-limit.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/api/src/exceptions/hit-rate-limit.ts b/api/src/exceptions/hit-rate-limit.ts index 6a7a51f897..f0760537b5 100644 --- a/api/src/exceptions/hit-rate-limit.ts +++ b/api/src/exceptions/hit-rate-limit.ts @@ -1,7 +1,12 @@ import { BaseException } from './base'; +type Extensions = { + limit: number; + reset: Date; +} + export class HitRateLimitException extends BaseException { - constructor(message: string) { - super(message, 429, 'REQUESTS_EXCEEDED'); + constructor(message: string, extensions: Extensions) { + super(message, 429, 'REQUESTS_EXCEEDED', extensions); } }