@unstoppabledomains/resolution
Version:
Domain Resolution for blockchain domains
61 lines (60 loc) • 2.79 kB
JavaScript
;
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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DnsRecordsError = exports.DnsRecordsErrorCode = void 0;
var DnsRecordsErrorCode;
(function (DnsRecordsErrorCode) {
DnsRecordsErrorCode["InconsistentTtl"] = "InconsistentTtl";
DnsRecordsErrorCode["DnsRecordCorrupted"] = "DnsRecordCorrupted";
})(DnsRecordsErrorCode = exports.DnsRecordsErrorCode || (exports.DnsRecordsErrorCode = {}));
/**
* @internal
* Internal Mapping object from DnsRecordsErrorCode to a DnsRecordsErrorHandler
*/
var HandlersByCode = (_a = {},
_a[DnsRecordsErrorCode.InconsistentTtl] = function (params) {
return "ttl for record ".concat(params.recordType, " is different for other records of the same type");
},
_a[DnsRecordsErrorCode.DnsRecordCorrupted] = function (params) {
return "dns record ".concat(params.recordType, " is invalid json-string");
},
_a);
/**
* Configuration Error class is designed to control every error being thrown by wrong configurations for objects
* @param code - Error Code
* - IncorrectProvider - When provider doesn't have implemented send or sendAsync methods
* - UnsupportedNetwork - When network is not specified or not supported
* - UnspecifiedUrl - When url is not specified for custom naming service configurations
* @param method - optional param to specify which namingService errored out
*/
var DnsRecordsError = /** @class */ (function (_super) {
__extends(DnsRecordsError, _super);
function DnsRecordsError(code, options) {
if (options === void 0) { options = {}; }
var _this = this;
var DnsRecordsErrorHandler = HandlersByCode[code];
_this = _super.call(this, DnsRecordsErrorHandler(options)) || this;
_this.code = code;
_this.name = 'DnsRecordsError';
Object.setPrototypeOf(_this, DnsRecordsError.prototype);
return _this;
}
return DnsRecordsError;
}(Error));
exports.DnsRecordsError = DnsRecordsError;
exports.default = DnsRecordsError;