UNPKG

twitch-js

Version:

Javascript library for the Twitch Messaging Interface.

83 lines 3.36 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var twitch_1 = require("../twitch"); var BaseError_1 = __importDefault(require("../utils/BaseError")); var ChatError = /** @class */ (function (_super) { __extends(ChatError, _super); function ChatError(error, message) { var _this = this; var errorMessage = error instanceof Error ? error.message : error; _this = _super.call(this, errorMessage + " [Chat]") || this; Object.setPrototypeOf(_this, ChatError.prototype); if (typeof message !== 'undefined' && typeof message !== 'string') { _this.command = message.command; } return _this; } return ChatError; }(BaseError_1.default)); var AuthenticationError = /** @class */ (function (_super) { __extends(AuthenticationError, _super); function AuthenticationError(error, message) { var _this = _super.call(this, 'Authentication error encountered', message) || this; Object.setPrototypeOf(_this, AuthenticationError.prototype); Object.assign(_this, error); Object.assign(_this, message); return _this; } return AuthenticationError; }(ChatError)); exports.AuthenticationError = AuthenticationError; var ParseError = /** @class */ (function (_super) { __extends(ParseError, _super); function ParseError(error, rawMessage) { var _this = _super.call(this, 'Parse error encountered') || this; Object.setPrototypeOf(_this, ParseError.prototype); Object.assign(_this, error); _this._raw = rawMessage; _this.command = twitch_1.ChatEvents.PARSE_ERROR_ENCOUNTERED; return _this; } return ParseError; }(ChatError)); exports.ParseError = ParseError; var JoinError = /** @class */ (function (_super) { __extends(JoinError, _super); function JoinError(message) { if (message === void 0) { message = 'Error: join'; } var _this = _super.call(this, message) || this; Object.setPrototypeOf(_this, JoinError.prototype); return _this; } return JoinError; }(ChatError)); exports.JoinError = JoinError; var TimeoutError = /** @class */ (function (_super) { __extends(TimeoutError, _super); function TimeoutError(message) { if (message === void 0) { message = 'Error: timeout'; } var _this = _super.call(this, message) || this; Object.setPrototypeOf(_this, TimeoutError.prototype); return _this; } return TimeoutError; }(ChatError)); exports.TimeoutError = TimeoutError; exports.default = ChatError; //# sourceMappingURL=Errors.js.map