From f155790f154c6590d37b60af94ff96c3e92cd0b4 Mon Sep 17 00:00:00 2001 From: Renan Ponick Date: Thu, 8 Jun 2023 10:44:05 -0300 Subject: [PATCH] feat: add too many requests error --- package.json | 2 +- src/errors.ts | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 10d3c0f..a162836 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "quirons-broker", - "version": "0.0.1-alpha.107", + "version": "0.0.1-alpha.108", "description": "A small library to expose the broker types", "main": "index.ts", "typings": "index.d.ts", diff --git a/src/errors.ts b/src/errors.ts index 90e80cd..4bc1a97 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -12,7 +12,8 @@ const ErrorCodeKey = t.keyof({ REQUIRED_BRANCH_ID: null, REQUIRED_ID_PARAMETER: null, BAD_REQUEST: null, - DECODED_ERROR: null + DECODED_ERROR: null, + TOO_MANY_REQUESTS: null }) type ErrorCode = t.TypeOf @@ -68,6 +69,11 @@ const errorInfoWith = (payload = ''): Record => ({ status: 400, message: 'Decoded error message', detailedMessage: 'The message sent is outside the established format' + }, + TOO_MANY_REQUESTS: { + status: 429, + message: 'Too many requests', + detailedMessage: 'You have exceeded the request limits, please wait and try again later.' } })