@twilio/flex-plugins-library-utils
Version:
Flex Plugins Library Utils
58 lines (48 loc) • 1.97 kB
text/typescript
export enum HttpErrorCode {
// Successful responses (200-299)
OK = 200,
// Client errors (400-499)
BadRequest = 400,
PreconditionFailed = 412,
TooManyRequests = 429,
RequestHeaderFieldsTooLarge = 431,
UnavailableForLegalReasons = 451,
// Server errors (500-599)
InternalServerError = 500,
NotImplemented = 501,
BadGateway = 502,
ServiceUnavailable = 503,
}
export const HttpStatusCodeDescription: { [key in HttpErrorCode]: string } = {
// Successful responses (200-299)
[ ]: 'OK',
// Client errors (400-499)
[ ]: 'Bad Request',
[ ]: 'Precondition Failed',
[ ]: 'Too Many Requests',
[ ]: 'Request Header Fields Too Large',
[ ]: 'Unavailable For Legal Reasons',
// Server errors (500-599)
[ ]: 'Internal Server Error',
[ ]: 'Not Implemented',
[ ]: 'Bad Gateway',
[ ]: 'Service Unavailable',
};
export enum TwilioErrorCode {
// Twilio specific errors
TaskNotAssigned = 20001,
TaskNotExist = 20404,
}
export const TwilioErrorCodeDescription: { [key in TwilioErrorCode]: string } = {
// Twilio specific errors
// 20001 error code is returned when the task is not in an assigned state
// this can happen if its not been assigned at all or its been already closed
// through another process; as a result assuming the latter and
// treating as a success
// https://www.twilio.com/docs/api/errors/20001
[ ]: 'Task is not in an assigned state',
// 20404 error code is returned when the task no longer exists
// in which case it is also assumed to be completed
// https://www.twilio.com/docs/api/errors/20404
[ ]: 'Task no longer exist',
};