@twilio/voice-sdk
Version:
Twilio's JavaScript Voice SDK
1,119 lines (1,116 loc) • 113 kB
JavaScript
'use strict';
var tslib = require('tslib');
var twilioError = require('./twilioError.js');
exports.AuthorizationErrors = void 0;
(function (AuthorizationErrors) {
/**
* Error received from the Twilio backend.
*/
var AccessTokenInvalid = /** @class */ (function (_super) {
tslib.__extends(AccessTokenInvalid, _super);
/**
* @internal
*/
function AccessTokenInvalid(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 20101;
_this.description = 'Invalid access token';
_this.explanation = 'Twilio was unable to validate your Access Token';
_this.name = 'AccessTokenInvalid';
_this.solutions = [];
Object.setPrototypeOf(_this, AuthorizationErrors.AccessTokenInvalid.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return AccessTokenInvalid;
}(twilioError.default));
AuthorizationErrors.AccessTokenInvalid = AccessTokenInvalid;
/**
* Error received from the Twilio backend.
*/
var AccessTokenExpired = /** @class */ (function (_super) {
tslib.__extends(AccessTokenExpired, _super);
/**
* @internal
*/
function AccessTokenExpired(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 20104;
_this.description = 'Access token expired or expiration date invalid';
_this.explanation = 'The Access Token provided to the Twilio API has expired, the expiration time specified in the token was invalid, or the expiration time specified was too far in the future';
_this.name = 'AccessTokenExpired';
_this.solutions = [];
Object.setPrototypeOf(_this, AuthorizationErrors.AccessTokenExpired.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return AccessTokenExpired;
}(twilioError.default));
AuthorizationErrors.AccessTokenExpired = AccessTokenExpired;
/**
* Error received from the Twilio backend.
*/
var AuthenticationFailed = /** @class */ (function (_super) {
tslib.__extends(AuthenticationFailed, _super);
/**
* @internal
*/
function AuthenticationFailed(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 20151;
_this.description = 'Authentication Failed';
_this.explanation = 'The Authentication with the provided JWT failed';
_this.name = 'AuthenticationFailed';
_this.solutions = [];
Object.setPrototypeOf(_this, AuthorizationErrors.AuthenticationFailed.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return AuthenticationFailed;
}(twilioError.default));
AuthorizationErrors.AuthenticationFailed = AuthenticationFailed;
})(exports.AuthorizationErrors || (exports.AuthorizationErrors = {}));
exports.SignatureValidationErrors = void 0;
(function (SignatureValidationErrors) {
/**
* Error received from the Twilio backend.
*/
var AccessTokenSignatureValidationFailed = /** @class */ (function (_super) {
tslib.__extends(AccessTokenSignatureValidationFailed, _super);
/**
* @internal
*/
function AccessTokenSignatureValidationFailed(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [
'The access token has an invalid Account SID, API Key, or API Key Secret.',
];
_this.code = 31202;
_this.description = 'Signature validation failed.';
_this.explanation = 'The provided access token failed signature validation.';
_this.name = 'AccessTokenSignatureValidationFailed';
_this.solutions = [
'Ensure the Account SID, API Key, and API Key Secret are valid when generating your access token.',
];
Object.setPrototypeOf(_this, SignatureValidationErrors.AccessTokenSignatureValidationFailed.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return AccessTokenSignatureValidationFailed;
}(twilioError.default));
SignatureValidationErrors.AccessTokenSignatureValidationFailed = AccessTokenSignatureValidationFailed;
})(exports.SignatureValidationErrors || (exports.SignatureValidationErrors = {}));
exports.ClientErrors = void 0;
(function (ClientErrors) {
/**
* Error received from the Twilio backend.
*/
var BadRequest = /** @class */ (function (_super) {
tslib.__extends(BadRequest, _super);
/**
* @internal
*/
function BadRequest(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31400;
_this.description = 'Bad Request (HTTP/SIP)';
_this.explanation = 'The request could not be understood due to malformed syntax.';
_this.name = 'BadRequest';
_this.solutions = [];
Object.setPrototypeOf(_this, ClientErrors.BadRequest.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return BadRequest;
}(twilioError.default));
ClientErrors.BadRequest = BadRequest;
/**
* Error received from the Twilio backend.
*/
var NotFound = /** @class */ (function (_super) {
tslib.__extends(NotFound, _super);
/**
* @internal
*/
function NotFound(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [
'The outbound call was made to an invalid phone number.',
'The TwiML application sid is missing a Voice URL.',
];
_this.code = 31404;
_this.description = 'Not Found (HTTP/SIP)';
_this.explanation = 'The server has not found anything matching the request.';
_this.name = 'NotFound';
_this.solutions = [
'Ensure the phone number dialed is valid.',
'Ensure the TwiML application is configured correctly with a Voice URL link.',
];
Object.setPrototypeOf(_this, ClientErrors.NotFound.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return NotFound;
}(twilioError.default));
ClientErrors.NotFound = NotFound;
/**
* Error received from the Twilio backend.
*/
var TemporarilyUnavailable = /** @class */ (function (_super) {
tslib.__extends(TemporarilyUnavailable, _super);
/**
* @internal
*/
function TemporarilyUnavailable(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31480;
_this.description = 'Temporarily Unavailable (SIP)';
_this.explanation = 'The callee is currently unavailable.';
_this.name = 'TemporarilyUnavailable';
_this.solutions = [];
Object.setPrototypeOf(_this, ClientErrors.TemporarilyUnavailable.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return TemporarilyUnavailable;
}(twilioError.default));
ClientErrors.TemporarilyUnavailable = TemporarilyUnavailable;
/**
* Error received from the Twilio backend.
*/
var BusyHere = /** @class */ (function (_super) {
tslib.__extends(BusyHere, _super);
/**
* @internal
*/
function BusyHere(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31486;
_this.description = 'Busy Here (SIP)';
_this.explanation = 'The callee is busy.';
_this.name = 'BusyHere';
_this.solutions = [];
Object.setPrototypeOf(_this, ClientErrors.BusyHere.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return BusyHere;
}(twilioError.default));
ClientErrors.BusyHere = BusyHere;
})(exports.ClientErrors || (exports.ClientErrors = {}));
exports.SIPServerErrors = void 0;
(function (SIPServerErrors) {
/**
* Error received from the Twilio backend.
*/
var Decline = /** @class */ (function (_super) {
tslib.__extends(Decline, _super);
/**
* @internal
*/
function Decline(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31603;
_this.description = 'Decline (SIP)';
_this.explanation = 'The callee does not wish to participate in the call.';
_this.name = 'Decline';
_this.solutions = [];
Object.setPrototypeOf(_this, SIPServerErrors.Decline.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return Decline;
}(twilioError.default));
SIPServerErrors.Decline = Decline;
})(exports.SIPServerErrors || (exports.SIPServerErrors = {}));
exports.GeneralErrors = void 0;
(function (GeneralErrors) {
/**
* Error received from the Twilio backend.
*/
var UnknownError = /** @class */ (function (_super) {
tslib.__extends(UnknownError, _super);
/**
* @internal
*/
function UnknownError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31000;
_this.description = 'Unknown Error';
_this.explanation = 'An unknown error has occurred. See error details for more information.';
_this.name = 'UnknownError';
_this.solutions = [];
Object.setPrototypeOf(_this, GeneralErrors.UnknownError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return UnknownError;
}(twilioError.default));
GeneralErrors.UnknownError = UnknownError;
/**
* Error received from the Twilio backend.
*/
var ApplicationNotFoundError = /** @class */ (function (_super) {
tslib.__extends(ApplicationNotFoundError, _super);
/**
* @internal
*/
function ApplicationNotFoundError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31001;
_this.description = 'Application Not Found';
_this.explanation = '';
_this.name = 'ApplicationNotFoundError';
_this.solutions = [];
Object.setPrototypeOf(_this, GeneralErrors.ApplicationNotFoundError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return ApplicationNotFoundError;
}(twilioError.default));
GeneralErrors.ApplicationNotFoundError = ApplicationNotFoundError;
/**
* Error received from the Twilio backend.
*/
var ConnectionDeclinedError = /** @class */ (function (_super) {
tslib.__extends(ConnectionDeclinedError, _super);
/**
* @internal
*/
function ConnectionDeclinedError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31002;
_this.description = 'Connection Declined';
_this.explanation = '';
_this.name = 'ConnectionDeclinedError';
_this.solutions = [];
Object.setPrototypeOf(_this, GeneralErrors.ConnectionDeclinedError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return ConnectionDeclinedError;
}(twilioError.default));
GeneralErrors.ConnectionDeclinedError = ConnectionDeclinedError;
/**
* Error received from the Twilio backend.
*/
var ConnectionTimeoutError = /** @class */ (function (_super) {
tslib.__extends(ConnectionTimeoutError, _super);
/**
* @internal
*/
function ConnectionTimeoutError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31003;
_this.description = 'Connection Timeout';
_this.explanation = 'The server could not produce a response within a suitable amount of time.';
_this.name = 'ConnectionTimeoutError';
_this.solutions = [];
Object.setPrototypeOf(_this, GeneralErrors.ConnectionTimeoutError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return ConnectionTimeoutError;
}(twilioError.default));
GeneralErrors.ConnectionTimeoutError = ConnectionTimeoutError;
/**
* Error received from the Twilio backend.
*/
var ConnectionError = /** @class */ (function (_super) {
tslib.__extends(ConnectionError, _super);
/**
* @internal
*/
function ConnectionError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31005;
_this.description = 'Connection error';
_this.explanation = 'A connection error occurred during the call';
_this.name = 'ConnectionError';
_this.solutions = [];
Object.setPrototypeOf(_this, GeneralErrors.ConnectionError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return ConnectionError;
}(twilioError.default));
GeneralErrors.ConnectionError = ConnectionError;
/**
* Error received from the Twilio backend.
*/
var CallCancelledError = /** @class */ (function (_super) {
tslib.__extends(CallCancelledError, _super);
/**
* @internal
*/
function CallCancelledError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [
'The incoming call was cancelled because it was not answered in time or it was accepted/rejected by another application instance registered with the same identity.',
];
_this.code = 31008;
_this.description = 'Call cancelled';
_this.explanation = 'Unable to answer because the call has ended';
_this.name = 'CallCancelledError';
_this.solutions = [];
Object.setPrototypeOf(_this, GeneralErrors.CallCancelledError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return CallCancelledError;
}(twilioError.default));
GeneralErrors.CallCancelledError = CallCancelledError;
/**
* Error received from the Twilio backend.
*/
var TransportError = /** @class */ (function (_super) {
tslib.__extends(TransportError, _super);
/**
* @internal
*/
function TransportError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31009;
_this.description = 'Transport error';
_this.explanation = 'No transport available to send or receive messages';
_this.name = 'TransportError';
_this.solutions = [];
Object.setPrototypeOf(_this, GeneralErrors.TransportError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return TransportError;
}(twilioError.default));
GeneralErrors.TransportError = TransportError;
})(exports.GeneralErrors || (exports.GeneralErrors = {}));
exports.MalformedRequestErrors = void 0;
(function (MalformedRequestErrors) {
/**
* Error received from the Twilio backend.
*/
var MalformedRequestError = /** @class */ (function (_super) {
tslib.__extends(MalformedRequestError, _super);
/**
* @internal
*/
function MalformedRequestError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [
'Invalid content or MessageType passed to sendMessage method.',
];
_this.code = 31100;
_this.description = 'The request had malformed syntax.';
_this.explanation = 'The request could not be understood due to malformed syntax.';
_this.name = 'MalformedRequestError';
_this.solutions = [
'Ensure content and MessageType passed to sendMessage method are valid.',
];
Object.setPrototypeOf(_this, MalformedRequestErrors.MalformedRequestError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return MalformedRequestError;
}(twilioError.default));
MalformedRequestErrors.MalformedRequestError = MalformedRequestError;
/**
* Error received from the Twilio backend.
*/
var MissingParameterArrayError = /** @class */ (function (_super) {
tslib.__extends(MissingParameterArrayError, _super);
/**
* @internal
*/
function MissingParameterArrayError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31101;
_this.description = 'Missing parameter array in request';
_this.explanation = '';
_this.name = 'MissingParameterArrayError';
_this.solutions = [];
Object.setPrototypeOf(_this, MalformedRequestErrors.MissingParameterArrayError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return MissingParameterArrayError;
}(twilioError.default));
MalformedRequestErrors.MissingParameterArrayError = MissingParameterArrayError;
/**
* Error received from the Twilio backend.
*/
var AuthorizationTokenMissingError = /** @class */ (function (_super) {
tslib.__extends(AuthorizationTokenMissingError, _super);
/**
* @internal
*/
function AuthorizationTokenMissingError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31102;
_this.description = 'Authorization token missing in request.';
_this.explanation = '';
_this.name = 'AuthorizationTokenMissingError';
_this.solutions = [];
Object.setPrototypeOf(_this, MalformedRequestErrors.AuthorizationTokenMissingError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return AuthorizationTokenMissingError;
}(twilioError.default));
MalformedRequestErrors.AuthorizationTokenMissingError = AuthorizationTokenMissingError;
/**
* Error received from the Twilio backend.
*/
var MaxParameterLengthExceededError = /** @class */ (function (_super) {
tslib.__extends(MaxParameterLengthExceededError, _super);
/**
* @internal
*/
function MaxParameterLengthExceededError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31103;
_this.description = 'Maximum parameter length has been exceeded.';
_this.explanation = 'Length of parameters cannot exceed MAX_PARAM_LENGTH.';
_this.name = 'MaxParameterLengthExceededError';
_this.solutions = [];
Object.setPrototypeOf(_this, MalformedRequestErrors.MaxParameterLengthExceededError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return MaxParameterLengthExceededError;
}(twilioError.default));
MalformedRequestErrors.MaxParameterLengthExceededError = MaxParameterLengthExceededError;
/**
* Error received from the Twilio backend.
*/
var InvalidBridgeTokenError = /** @class */ (function (_super) {
tslib.__extends(InvalidBridgeTokenError, _super);
/**
* @internal
*/
function InvalidBridgeTokenError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31104;
_this.description = 'Invalid bridge token';
_this.explanation = '';
_this.name = 'InvalidBridgeTokenError';
_this.solutions = [];
Object.setPrototypeOf(_this, MalformedRequestErrors.InvalidBridgeTokenError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return InvalidBridgeTokenError;
}(twilioError.default));
MalformedRequestErrors.InvalidBridgeTokenError = InvalidBridgeTokenError;
/**
* Error received from the Twilio backend.
*/
var InvalidClientNameError = /** @class */ (function (_super) {
tslib.__extends(InvalidClientNameError, _super);
/**
* @internal
*/
function InvalidClientNameError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [
'Client name contains invalid characters.',
];
_this.code = 31105;
_this.description = 'Invalid client name';
_this.explanation = 'Client name should not contain control, space, delims, or unwise characters.';
_this.name = 'InvalidClientNameError';
_this.solutions = [
'Make sure that client name does not contain any of the invalid characters.',
];
Object.setPrototypeOf(_this, MalformedRequestErrors.InvalidClientNameError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return InvalidClientNameError;
}(twilioError.default));
MalformedRequestErrors.InvalidClientNameError = InvalidClientNameError;
/**
* Error received from the Twilio backend.
*/
var ReconnectParameterInvalidError = /** @class */ (function (_super) {
tslib.__extends(ReconnectParameterInvalidError, _super);
/**
* @internal
*/
function ReconnectParameterInvalidError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31107;
_this.description = 'The reconnect parameter is invalid';
_this.explanation = '';
_this.name = 'ReconnectParameterInvalidError';
_this.solutions = [];
Object.setPrototypeOf(_this, MalformedRequestErrors.ReconnectParameterInvalidError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return ReconnectParameterInvalidError;
}(twilioError.default));
MalformedRequestErrors.ReconnectParameterInvalidError = ReconnectParameterInvalidError;
})(exports.MalformedRequestErrors || (exports.MalformedRequestErrors = {}));
(function (AuthorizationErrors) {
/**
* Error received from the Twilio backend.
*/
var AuthorizationError = /** @class */ (function (_super) {
tslib.__extends(AuthorizationError, _super);
/**
* @internal
*/
function AuthorizationError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31201;
_this.description = 'Authorization error';
_this.explanation = 'The request requires user authentication. The server understood the request, but is refusing to fulfill it.';
_this.name = 'AuthorizationError';
_this.solutions = [];
Object.setPrototypeOf(_this, AuthorizationErrors.AuthorizationError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return AuthorizationError;
}(twilioError.default));
AuthorizationErrors.AuthorizationError = AuthorizationError;
/**
* Error received from the Twilio backend.
*/
var NoValidAccountError = /** @class */ (function (_super) {
tslib.__extends(NoValidAccountError, _super);
/**
* @internal
*/
function NoValidAccountError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31203;
_this.description = 'No valid account';
_this.explanation = '';
_this.name = 'NoValidAccountError';
_this.solutions = [];
Object.setPrototypeOf(_this, AuthorizationErrors.NoValidAccountError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return NoValidAccountError;
}(twilioError.default));
AuthorizationErrors.NoValidAccountError = NoValidAccountError;
/**
* Error received from the Twilio backend.
*/
var InvalidJWTTokenError = /** @class */ (function (_super) {
tslib.__extends(InvalidJWTTokenError, _super);
/**
* @internal
*/
function InvalidJWTTokenError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31204;
_this.description = 'Invalid JWT token';
_this.explanation = '';
_this.name = 'InvalidJWTTokenError';
_this.solutions = [];
Object.setPrototypeOf(_this, AuthorizationErrors.InvalidJWTTokenError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return InvalidJWTTokenError;
}(twilioError.default));
AuthorizationErrors.InvalidJWTTokenError = InvalidJWTTokenError;
/**
* Error received from the Twilio backend.
*/
var JWTTokenExpiredError = /** @class */ (function (_super) {
tslib.__extends(JWTTokenExpiredError, _super);
/**
* @internal
*/
function JWTTokenExpiredError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31205;
_this.description = 'JWT token expired';
_this.explanation = '';
_this.name = 'JWTTokenExpiredError';
_this.solutions = [];
Object.setPrototypeOf(_this, AuthorizationErrors.JWTTokenExpiredError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return JWTTokenExpiredError;
}(twilioError.default));
AuthorizationErrors.JWTTokenExpiredError = JWTTokenExpiredError;
/**
* Error received from the Twilio backend.
*/
var RateExceededError = /** @class */ (function (_super) {
tslib.__extends(RateExceededError, _super);
/**
* @internal
*/
function RateExceededError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [
'Rate limit exceeded.',
];
_this.code = 31206;
_this.description = 'Rate exceeded authorized limit.';
_this.explanation = 'The request performed exceeds the authorized limit.';
_this.name = 'RateExceededError';
_this.solutions = [
'Ensure message send rate does not exceed authorized limits.',
];
Object.setPrototypeOf(_this, AuthorizationErrors.RateExceededError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return RateExceededError;
}(twilioError.default));
AuthorizationErrors.RateExceededError = RateExceededError;
/**
* Error received from the Twilio backend.
*/
var JWTTokenExpirationTooLongError = /** @class */ (function (_super) {
tslib.__extends(JWTTokenExpirationTooLongError, _super);
/**
* @internal
*/
function JWTTokenExpirationTooLongError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31207;
_this.description = 'JWT token expiration too long';
_this.explanation = '';
_this.name = 'JWTTokenExpirationTooLongError';
_this.solutions = [];
Object.setPrototypeOf(_this, AuthorizationErrors.JWTTokenExpirationTooLongError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return JWTTokenExpirationTooLongError;
}(twilioError.default));
AuthorizationErrors.JWTTokenExpirationTooLongError = JWTTokenExpirationTooLongError;
/**
* Error received from the Twilio backend.
*/
var ReconnectAttemptError = /** @class */ (function (_super) {
tslib.__extends(ReconnectAttemptError, _super);
/**
* @internal
*/
function ReconnectAttemptError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31209;
_this.description = 'Reconnect attempt is not authorized.';
_this.explanation = '';
_this.name = 'ReconnectAttemptError';
_this.solutions = [];
Object.setPrototypeOf(_this, AuthorizationErrors.ReconnectAttemptError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return ReconnectAttemptError;
}(twilioError.default));
AuthorizationErrors.ReconnectAttemptError = ReconnectAttemptError;
/**
* Error received from the Twilio backend.
*/
var CallMessageEventTypeInvalidError = /** @class */ (function (_super) {
tslib.__extends(CallMessageEventTypeInvalidError, _super);
/**
* @internal
*/
function CallMessageEventTypeInvalidError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [
'The Call Message Event Type is invalid and is not understood by Twilio Voice.',
];
_this.code = 31210;
_this.description = 'Call Message Event Type is invalid.';
_this.explanation = 'The Call Message Event Type is invalid and is not understood by Twilio Voice.';
_this.name = 'CallMessageEventTypeInvalidError';
_this.solutions = [
'Ensure the Call Message Event Type is Valid and understood by Twilio Voice and try again.',
];
Object.setPrototypeOf(_this, AuthorizationErrors.CallMessageEventTypeInvalidError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return CallMessageEventTypeInvalidError;
}(twilioError.default));
AuthorizationErrors.CallMessageEventTypeInvalidError = CallMessageEventTypeInvalidError;
/**
* Error received from the Twilio backend.
*/
var PayloadSizeExceededError = /** @class */ (function (_super) {
tslib.__extends(PayloadSizeExceededError, _super);
/**
* @internal
*/
function PayloadSizeExceededError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [
'The payload size of Call Message Event exceeds the authorized limit.',
];
_this.code = 31212;
_this.description = 'Call Message Event Payload size exceeded authorized limit.';
_this.explanation = 'The request performed to send a Call Message Event exceeds the payload size authorized limit';
_this.name = 'PayloadSizeExceededError';
_this.solutions = [
'Reduce payload size of Call Message Event to be within the authorized limit and try again.',
];
Object.setPrototypeOf(_this, AuthorizationErrors.PayloadSizeExceededError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return PayloadSizeExceededError;
}(twilioError.default));
AuthorizationErrors.PayloadSizeExceededError = PayloadSizeExceededError;
})(exports.AuthorizationErrors || (exports.AuthorizationErrors = {}));
exports.UserMediaErrors = void 0;
(function (UserMediaErrors) {
/**
* Error received from the Twilio backend.
*/
var PermissionDeniedError = /** @class */ (function (_super) {
tslib.__extends(PermissionDeniedError, _super);
/**
* @internal
*/
function PermissionDeniedError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [
'The user denied the getUserMedia request.',
'The browser denied the getUserMedia request.',
];
_this.code = 31401;
_this.description = 'UserMedia Permission Denied Error';
_this.explanation = 'The browser or end-user denied permissions to user media. Therefore we were unable to acquire input audio.';
_this.name = 'PermissionDeniedError';
_this.solutions = [
'The user should accept the request next time prompted. If the browser saved the deny, the user should change that permission in their browser.',
'The user should to verify that the browser has permission to access the microphone at this address.',
];
Object.setPrototypeOf(_this, UserMediaErrors.PermissionDeniedError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return PermissionDeniedError;
}(twilioError.default));
UserMediaErrors.PermissionDeniedError = PermissionDeniedError;
/**
* Error received from the Twilio backend.
*/
var AcquisitionFailedError = /** @class */ (function (_super) {
tslib.__extends(AcquisitionFailedError, _super);
/**
* @internal
*/
function AcquisitionFailedError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [
'NotFoundError - The deviceID specified was not found.',
'The getUserMedia constraints were overconstrained and no devices matched.',
];
_this.code = 31402;
_this.description = 'UserMedia Acquisition Failed Error';
_this.explanation = 'The browser and end-user allowed permissions, however getting the media failed. Usually this is due to bad constraints, but can sometimes fail due to browser, OS or hardware issues.';
_this.name = 'AcquisitionFailedError';
_this.solutions = [
'Ensure the deviceID being specified exists.',
'Try acquiring media with fewer constraints.',
];
Object.setPrototypeOf(_this, UserMediaErrors.AcquisitionFailedError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);
_this.originalError = originalError;
return _this;
}
return AcquisitionFailedError;
}(twilioError.default));
UserMediaErrors.AcquisitionFailedError = AcquisitionFailedError;
})(exports.UserMediaErrors || (exports.UserMediaErrors = {}));
exports.SignalingErrors = void 0;
(function (SignalingErrors) {
/**
* Error received from the Twilio backend.
*/
var ConnectionError = /** @class */ (function (_super) {
tslib.__extends(ConnectionError, _super);
/**
* @internal
*/
function ConnectionError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 53000;
_this.description = 'Signaling connection error';
_this.explanation = 'Raised whenever a signaling connection error occurs that is not covered by a more specific error code.';
_this.name = 'ConnectionError';
_this.solutions = [];
Object.setPrototypeOf(_this, SignalingErrors.ConnectionError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = "".concat(_this.name, " (").concat(_this.code, "): ").concat(message);