Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/rest/axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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)) {
Expand Down
1 change: 1 addition & 0 deletions lib/rest/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion lib/utils/exceptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 { }
export class NotAcceptableError extends PlivoRestError { }
export class TooManyRequestsError extends PlivoRestError { }