roboto-js 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -270,7 +270,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
270
270
  if (dataHash) {
271
271
  record.data = dataHash;
272
272
  }
273
- return _context6.abrupt("return", new _rbt_object["default"](record, this.axios));
273
+ return _context6.abrupt("return", new _rbt_user["default"](record, this.axios));
274
274
  case 10:
275
275
  _context6.prev = 10;
276
276
  _context6.t0 = _context6["catch"](1);
@@ -825,7 +825,6 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
825
825
  }, {
826
826
  key: "_handleError",
827
827
  value: function _handleError(err) {
828
- debugger;
829
828
  // Invoke the custom error handler if provided
830
829
  if (this.customErrorHandler) {
831
830
  var res = this.customErrorHandler(err);
@@ -833,11 +832,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
833
832
  }
834
833
  if (_lodash["default"].isObject(err) && _lodash["default"].get(err, 'response')) {
835
834
  var msg = _lodash["default"].get(err, 'response.data.message', 'Error in API response');
836
- if (msg.key) {
837
- throw new Error(msg.key);
838
- } else {
839
- throw new Error(msg);
840
- }
835
+ throw new Error(msg);
841
836
  } else {
842
837
  throw new Error(err.message || 'Unknown error');
843
838
  }
@@ -270,7 +270,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
270
270
  if (dataHash) {
271
271
  record.data = dataHash;
272
272
  }
273
- return _context6.abrupt("return", new _rbt_object["default"](record, this.axios));
273
+ return _context6.abrupt("return", new _rbt_user["default"](record, this.axios));
274
274
  case 10:
275
275
  _context6.prev = 10;
276
276
  _context6.t0 = _context6["catch"](1);
@@ -825,7 +825,6 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
825
825
  }, {
826
826
  key: "_handleError",
827
827
  value: function _handleError(err) {
828
- debugger;
829
828
  // Invoke the custom error handler if provided
830
829
  if (this.customErrorHandler) {
831
830
  var res = this.customErrorHandler(err);
@@ -833,11 +832,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
833
832
  }
834
833
  if (_lodash["default"].isObject(err) && _lodash["default"].get(err, 'response')) {
835
834
  var msg = _lodash["default"].get(err, 'response.data.message', 'Error in API response');
836
- if (msg.key) {
837
- throw new Error(msg.key);
838
- } else {
839
- throw new Error(msg);
840
- }
835
+ throw new Error(msg);
841
836
  } else {
842
837
  throw new Error(err.message || 'Unknown error');
843
838
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roboto-js",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "dist/cjs/index.cjs",
package/src/rbt_api.js CHANGED
@@ -2,7 +2,7 @@ import axios from 'axios';
2
2
  import CryptoJS from 'crypto-js';
3
3
  import RbtObject from './rbt_object.js';
4
4
  import RbtUser from './rbt_user.js';
5
- import RbtFile from './rbt_file.js';
5
+ import RbtFile from './rbt_file.js';
6
6
  import _ from 'lodash';
7
7
  import { openDB } from 'idb';
8
8
 
@@ -159,7 +159,7 @@ export default class RbtApi {
159
159
  if(dataHash){
160
160
  record.data = dataHash;
161
161
  }
162
- return new RbtObject(record, this.axios);
162
+ return new RbtUser(record, this.axios);
163
163
  } catch (e) {
164
164
  debugger;
165
165
  return this._handleError(e);
@@ -478,7 +478,6 @@ export default class RbtApi {
478
478
 
479
479
  _handleError(err) {
480
480
 
481
- debugger;
482
481
  // Invoke the custom error handler if provided
483
482
  if (this.customErrorHandler) {
484
483
  let res = this.customErrorHandler(err);
@@ -487,13 +486,8 @@ export default class RbtApi {
487
486
 
488
487
  if (_.isObject(err) && _.get(err, 'response')) {
489
488
  const msg = _.get(err, 'response.data.message', 'Error in API response');
489
+ throw new Error(msg);
490
490
 
491
- if(msg.key){
492
- throw new Error(msg.key);
493
- }
494
- else{
495
- throw new Error(msg);
496
- }
497
491
  } else {
498
492
  throw new Error(err.message || 'Unknown error');
499
493
  }