jsonrpctts
Version:
A TypeScript JSON-RPC 2.0 client with axios
57 lines • 2.29 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 __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.NetworkError = exports.BackendError = exports.RPCError = void 0;
// src/errors.ts
var RPCError = /** @class */ (function (_super) {
__extends(RPCError, _super);
function RPCError(message, code, data) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
_this.code = code;
_this.data = data;
_this.name = _this.constructor.name;
Object.setPrototypeOf(_this, _newTarget.prototype);
return _this;
}
return RPCError;
}(Error));
exports.RPCError = RPCError;
var BackendError = /** @class */ (function (_super) {
__extends(BackendError, _super);
function BackendError(message, code, data) {
var _this = _super.call(this, message, code, data) || this;
_this.name = "BackendError";
Object.setPrototypeOf(_this, BackendError.prototype);
return _this;
}
return BackendError;
}(RPCError));
exports.BackendError = BackendError;
var NetworkError = /** @class */ (function (_super) {
__extends(NetworkError, _super);
function NetworkError(message, code) {
if (code === void 0) { code = -1; }
var _this = _super.call(this, message, code) || this;
_this.name = "NetworkError";
Object.setPrototypeOf(_this, NetworkError.prototype);
return _this;
}
return NetworkError;
}(RPCError));
exports.NetworkError = NetworkError;
//# sourceMappingURL=errors.js.map