diff --git a/lib/rest/axios.js b/lib/rest/axios.js index ce91738b..7f42cdd0 100644 --- a/lib/rest/axios.js +++ b/lib/rest/axios.js @@ -77,6 +77,7 @@ export function Axios(config) { 404: Exceptions.ResourceNotFoundError, 405: Exceptions.InvalidRequestError, 406: Exceptions.NotAcceptableError, + 429: Exceptions.TooManyRequestsError, 500: Exceptions.ServerError, } [response.status] || Error; @@ -105,6 +106,7 @@ export function Axios(config) { 404: Exceptions.ResourceNotFoundError, 405: Exceptions.InvalidRequestError, 406: Exceptions.NotAcceptableError, + 429: Exceptions.TooManyRequestsError, 500: Exceptions.ServerError, } [error.response.status] || Error; if (!_.inRange(error.response.status, 200, 300)) { @@ -258,6 +260,7 @@ export function Axios(config) { 500: Exceptions.ServerError, 409: Exceptions.InvalidRequestError, 422: Exceptions.InvalidRequestError, + 429: Exceptions.TooManyRequestsError, 207: Exceptions.InvalidRequestError, } [response.status] || Error; @@ -295,6 +298,7 @@ export function Axios(config) { 500: Exceptions.ServerError, 409: Exceptions.InvalidRequestError, 422: Exceptions.InvalidRequestError, + 429: Exceptions.TooManyRequestsError, 207: Exceptions.InvalidRequestError, } [error.response.status] || Error; if (!_.inRange(error.response.status, 200, 300)) { diff --git a/lib/rest/request.js b/lib/rest/request.js index 4a908190..9974404f 100644 --- a/lib/rest/request.js +++ b/lib/rest/request.js @@ -194,6 +194,7 @@ export function Request(config) { 401: Exceptions.AuthenticationError, 404: Exceptions.ResourceNotFoundError, 405: Exceptions.InvalidRequestError, + 429: Exceptions.TooManyRequestsError, 500: Exceptions.ServerError, } [response.statusCode] || Error; diff --git a/lib/utils/exceptions.js b/lib/utils/exceptions.js index caa0bcda..8ebfff24 100644 --- a/lib/utils/exceptions.js +++ b/lib/utils/exceptions.js @@ -5,4 +5,5 @@ export class InvalidRequestError extends PlivoRestError { } export class PlivoXMLError extends PlivoRestError { } export class PlivoXMLValidationError extends PlivoRestError { } export class AuthenticationError extends PlivoRestError { } -export class NotAcceptableError extends PlivoRestError { } \ No newline at end of file +export class NotAcceptableError extends PlivoRestError { } +export class TooManyRequestsError extends PlivoRestError { } \ No newline at end of file