roboto-js 1.8.2 → 1.8.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.
package/.last-build CHANGED
@@ -1 +1 @@
1
- 2025-10-08T11:01:38.750Z
1
+ 2025-10-09T19:09:24.387Z
@@ -1745,6 +1745,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1745
1745
  status,
1746
1746
  message,
1747
1747
  output,
1748
+ errorResponse,
1748
1749
  _args25 = arguments;
1749
1750
  return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1750
1751
  while (1) switch (_context25.prev = _context25.next) {
@@ -1802,18 +1803,28 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1802
1803
  case 20:
1803
1804
  _context25.prev = 20;
1804
1805
  _context25.t0 = _context25["catch"](3);
1805
- if (typeof onError === 'function') {
1806
- onError(_context25.t0);
1807
- } else {
1808
- console.error('Error in runTask:', _context25.t0);
1809
- }
1810
- return _context25.abrupt("return", {
1806
+ // Standardize error format to match task response object
1807
+ // Support RbtError format with label and message
1808
+ errorResponse = {
1811
1809
  ok: false,
1812
1810
  jobId: null,
1813
1811
  status: 'ERROR',
1814
- error: _context25.t0.message
1815
- });
1816
- case 24:
1812
+ message: _context25.t0.message || _context25.t0.toString() || 'Unknown error',
1813
+ label: _context25.t0.label || _context25.t0.name || 'Error',
1814
+ output: {
1815
+ error: _context25.t0.message,
1816
+ label: _context25.t0.label,
1817
+ stack: _context25.t0.stack,
1818
+ originalError: _context25.t0
1819
+ }
1820
+ };
1821
+ if (typeof onError === 'function') {
1822
+ onError(errorResponse);
1823
+ } else {
1824
+ console.error('Error in runTask:', errorResponse.message);
1825
+ }
1826
+ return _context25.abrupt("return", errorResponse);
1827
+ case 25:
1817
1828
  case "end":
1818
1829
  return _context25.stop();
1819
1830
  }
@@ -1917,7 +1928,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1917
1928
  }
1918
1929
 
1919
1930
  // Provide the current progress to the callback function
1920
- if (response.status == 'RUNNING') {
1931
+ if (response.status == 'RUNNING' && onProgress) {
1921
1932
  onProgress(response);
1922
1933
  }
1923
1934
 
@@ -1049,17 +1049,27 @@ export default class RbtApi {
1049
1049
  output
1050
1050
  };
1051
1051
  } catch (e) {
1052
- if (typeof onError === 'function') {
1053
- onError(e);
1054
- } else {
1055
- console.error('Error in runTask:', e);
1056
- }
1057
- return {
1052
+ // Standardize error format to match task response object
1053
+ // Support RbtError format with label and message
1054
+ const errorResponse = {
1058
1055
  ok: false,
1059
1056
  jobId: null,
1060
1057
  status: 'ERROR',
1061
- error: e.message
1058
+ message: e.message || e.toString() || 'Unknown error',
1059
+ label: e.label || e.name || 'Error',
1060
+ output: {
1061
+ error: e.message,
1062
+ label: e.label,
1063
+ stack: e.stack,
1064
+ originalError: e
1065
+ }
1062
1066
  };
1067
+ if (typeof onError === 'function') {
1068
+ onError(errorResponse);
1069
+ } else {
1070
+ console.error('Error in runTask:', errorResponse.message);
1071
+ }
1072
+ return errorResponse;
1063
1073
  }
1064
1074
  }
1065
1075
  async stopJob(params = {}, callbacks = {}) {
@@ -1120,7 +1130,7 @@ export default class RbtApi {
1120
1130
  }
1121
1131
 
1122
1132
  // Provide the current progress to the callback function
1123
- if (response.status == 'RUNNING') {
1133
+ if (response.status == 'RUNNING' && onProgress) {
1124
1134
  onProgress(response);
1125
1135
  }
1126
1136
 
package/dist/rbt_api.js CHANGED
@@ -1697,6 +1697,7 @@ var RbtApi = /*#__PURE__*/function () {
1697
1697
  status,
1698
1698
  message,
1699
1699
  output,
1700
+ errorResponse,
1700
1701
  _args23 = arguments,
1701
1702
  _t17;
1702
1703
  return _regenerator().w(function (_context23) {
@@ -1755,17 +1756,27 @@ var RbtApi = /*#__PURE__*/function () {
1755
1756
  case 5:
1756
1757
  _context23.p = 5;
1757
1758
  _t17 = _context23.v;
1758
- if (typeof onError === 'function') {
1759
- onError(_t17);
1760
- } else {
1761
- console.error('Error in runTask:', _t17);
1762
- }
1763
- return _context23.a(2, {
1759
+ // Standardize error format to match task response object
1760
+ // Support RbtError format with label and message
1761
+ errorResponse = {
1764
1762
  ok: false,
1765
1763
  jobId: null,
1766
1764
  status: 'ERROR',
1767
- error: _t17.message
1768
- });
1765
+ message: _t17.message || _t17.toString() || 'Unknown error',
1766
+ label: _t17.label || _t17.name || 'Error',
1767
+ output: {
1768
+ error: _t17.message,
1769
+ label: _t17.label,
1770
+ stack: _t17.stack,
1771
+ originalError: _t17
1772
+ }
1773
+ };
1774
+ if (typeof onError === 'function') {
1775
+ onError(errorResponse);
1776
+ } else {
1777
+ console.error('Error in runTask:', errorResponse.message);
1778
+ }
1779
+ return _context23.a(2, errorResponse);
1769
1780
  }
1770
1781
  }, _callee23, this, [[1, 5]]);
1771
1782
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roboto-js",
3
- "version": "1.8.2",
3
+ "version": "1.8.3",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "dist/cjs/index.cjs",
package/src/rbt_api.js CHANGED
@@ -1098,13 +1098,28 @@ export default class RbtApi {
1098
1098
  return { ok, jobId, status, message, output };
1099
1099
 
1100
1100
  } catch (e) {
1101
+ // Standardize error format to match task response object
1102
+ // Support RbtError format with label and message
1103
+ const errorResponse = {
1104
+ ok: false,
1105
+ jobId: null,
1106
+ status: 'ERROR',
1107
+ message: e.message || e.toString() || 'Unknown error',
1108
+ label: e.label || e.name || 'Error',
1109
+ output: {
1110
+ error: e.message,
1111
+ label: e.label,
1112
+ stack: e.stack,
1113
+ originalError: e
1114
+ }
1115
+ };
1101
1116
 
1102
1117
  if (typeof onError === 'function') {
1103
- onError(e);
1118
+ onError(errorResponse);
1104
1119
  } else {
1105
- console.error('Error in runTask:', e);
1120
+ console.error('Error in runTask:', errorResponse.message);
1106
1121
  }
1107
- return { ok: false, jobId: null, status: 'ERROR', error: e.message };
1122
+ return errorResponse;
1108
1123
 
1109
1124
  }
1110
1125
  }
@@ -1163,7 +1178,7 @@ export default class RbtApi {
1163
1178
  }
1164
1179
 
1165
1180
  // Provide the current progress to the callback function
1166
- if(response.status == 'RUNNING'){
1181
+ if(response.status == 'RUNNING' && onProgress){
1167
1182
  onProgress(response);
1168
1183
  }
1169
1184