diff --git a/dist/bundle.js b/dist/bundle.js index a942db9..e477dcc 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -2171,10 +2171,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; // @flow + + __webpack_require__(10); -var CHECK_DAEMON_STARTED_TRY_NUMBER = 200; // @flow - +var CHECK_DAEMON_STARTED_TRY_NUMBER = 200; var Lbry = { isConnected: false, @@ -2189,7 +2191,8 @@ function checkAndParse(response) { return response.json().then(function (json) { var error = void 0; if (json.error) { - error = new Error(json.error); + var errorMessage = _typeof(json.error) === 'object' ? json.error.message : json.error; + error = new Error(errorMessage); } else { error = new Error('Protocol error with unknown response signature'); } diff --git a/src/lbry.js b/src/lbry.js index 82629e4..765ac27 100644 --- a/src/lbry.js +++ b/src/lbry.js @@ -16,7 +16,8 @@ function checkAndParse(response) { return response.json().then(json => { let error; if (json.error) { - error = new Error(json.error); + const errorMessage = typeof json.error === 'object' ? json.error.message : json.error; + error = new Error(errorMessage); } else { error = new Error('Protocol error with unknown response signature'); }