UNPKG

twitch-js

Version:

Javascript library for the Twitch Messaging Interface.

60 lines 2.59 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 }); exports.ParseError = exports.AuthenticationError = exports.ClientError = void 0; var twitch_1 = require("../twitch"); var BaseError_1 = __importDefault(require("../utils/BaseError")); var ClientError = /** @class */ (function (_super) { __extends(ClientError, _super); function ClientError(error, message) { var _this = _super.call(this, (error instanceof Error ? error.message : error) + " [Chat]") || this; Object.setPrototypeOf(_this, ClientError.prototype); if (typeof message !== 'undefined' && typeof message !== 'string') { _this.command = message.command; } return _this; } return ClientError; }(BaseError_1.default)); exports.ClientError = ClientError; 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; }(ClientError)); 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; }(ClientError)); exports.ParseError = ParseError; //# sourceMappingURL=Errors.js.map