UNPKG

@twilio/flex-plugins-library-utils

Version:

Flex Plugins Library Utils

58 lines (48 loc) 1.97 kB
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) [HttpErrorCode.OK]: 'OK', // Client errors (400-499) [HttpErrorCode.BadRequest]: 'Bad Request', [HttpErrorCode.PreconditionFailed]: 'Precondition Failed', [HttpErrorCode.TooManyRequests]: 'Too Many Requests', [HttpErrorCode.RequestHeaderFieldsTooLarge]: 'Request Header Fields Too Large', [HttpErrorCode.UnavailableForLegalReasons]: 'Unavailable For Legal Reasons', // Server errors (500-599) [HttpErrorCode.InternalServerError]: 'Internal Server Error', [HttpErrorCode.NotImplemented]: 'Not Implemented', [HttpErrorCode.BadGateway]: 'Bad Gateway', [HttpErrorCode.ServiceUnavailable]: '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 [TwilioErrorCode.TaskNotAssigned]: '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 [TwilioErrorCode.TaskNotExist]: 'Task no longer exist', };