UNPKG

2.11 kBJavaScriptView Raw
1"use strict";
2/**
3 * @module RPC-Error
4 */
5// copyright defined in eosjs/LICENSE.txt
6var __extends = (this && this.__extends) || (function () {
7 var extendStatics = function (d, b) {
8 extendStatics = Object.setPrototypeOf ||
9 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
10 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
11 return extendStatics(d, b);
12 };
13 return function (d, b) {
14 if (typeof b !== "function" && b !== null)
15 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
16 extendStatics(d, b);
17 function __() { this.constructor = d; }
18 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
19 };
20})();
21Object.defineProperty(exports, "__esModule", { value: true });
22exports.RpcError = void 0;
23/** Holds detailed error information */
24var RpcError = /** @class */ (function (_super) {
25 __extends(RpcError, _super);
26 function RpcError(json) {
27 var _this = this;
28 if (json.error && json.error.details && json.error.details.length && json.error.details[0].message) {
29 _this = _super.call(this, json.error.details[0].message) || this;
30 _this.details = json.error.details;
31 }
32 else if (json.processed && json.processed.except && json.processed.except.message) {
33 _this = _super.call(this, json.processed.except.message) || this;
34 _this.details = json.processed.except;
35 }
36 else if (json.result && json.result.except && json.result.except.message) {
37 _this = _super.call(this, json.result.except.message) || this;
38 _this.details = json.result.except;
39 }
40 else {
41 _this = _super.call(this, json.message) || this;
42 }
43 Object.setPrototypeOf(_this, RpcError.prototype);
44 _this.json = json;
45 return _this;
46 }
47 return RpcError;
48}(Error));
49exports.RpcError = RpcError;
50//# sourceMappingURL=eosjs-rpcerror.js.map
\No newline at end of file