diff --git a/package.json b/package.json index 7927ca8..fa213d3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ztimson/utils", - "version": "0.28.5", + "version": "0.28.6", "description": "Utility library", "author": "Zak Timson", "license": "MIT", diff --git a/src/errors.ts b/src/errors.ts index 9780f57..737a8ef 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -113,6 +113,18 @@ export class NotAcceptableError extends CustomError { } } +export class TooManyRequestsError extends CustomError { + static code = 429; + + constructor(message: string = 'Rate Limit Reached') { + super(message); + } + + static instanceof(err: Error) { + return (err).constructor.code == this.code; + } +} + export class InternalServerError extends CustomError { static code = 500;