@iotize/device-client.js
Version:
IoTize Device client for Javascript
42 lines (41 loc) • 1.93 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var 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 function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var TapError = /** @class */ (function (_super) {
__extends(TapError, _super);
function TapError(code, message, cause) {
var _this = _super.call(this, message) || this;
_this.cause = cause;
_this.code = code;
return _this;
}
TapError.cannotStartScram = function (err) {
return new TapError(TapError.Code.CannotStartScram, "Cannot start encrypted session, initialization failed. Cause: " + err.message, err);
};
TapError.notImplementedYet = function (msg) {
throw new TapError(TapError.Code.NotImplemented, msg);
};
TapError.initializationVectorNotSupported = function (err) {
return new TapError(TapError.Code.InitializationVectorNotSupported, "Initialization vector for SCRAM is not implemented with your current firmware version. You cannot use this feature.", err);
};
return TapError;
}(Error));
exports.TapError = TapError;
(function (TapError) {
var Code;
(function (Code) {
Code["CannotStartScram"] = "CannotStartScram";
Code["NotImplemented"] = "NotImplemented";
Code["InitializationVectorNotSupported"] = "InitializationVectorNotSupported";
})(Code = TapError.Code || (TapError.Code = {}));
})(TapError = exports.TapError || (exports.TapError = {}));
exports.TapError = TapError;