roboto-js 1.6.17 → 1.6.18
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.
|
@@ -90,6 +90,12 @@ var RbtMetricsApi = exports["default"] = /*#__PURE__*/function (_EventEmitter) {
|
|
|
90
90
|
parts,
|
|
91
91
|
deviceId,
|
|
92
92
|
res,
|
|
93
|
+
summary,
|
|
94
|
+
_err$response,
|
|
95
|
+
_err$response2,
|
|
96
|
+
_err$response3,
|
|
97
|
+
_err$config,
|
|
98
|
+
_err$config2,
|
|
93
99
|
_args = arguments;
|
|
94
100
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
95
101
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -134,9 +140,23 @@ var RbtMetricsApi = exports["default"] = /*#__PURE__*/function (_EventEmitter) {
|
|
|
134
140
|
case 21:
|
|
135
141
|
_context.prev = 21;
|
|
136
142
|
_context.t0 = _context["catch"](13);
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
143
|
+
// Summarize Axios errors for clarity
|
|
144
|
+
summary = _context.t0;
|
|
145
|
+
if (_context.t0.isAxiosError) {
|
|
146
|
+
summary = {
|
|
147
|
+
isAxiosError: true,
|
|
148
|
+
message: _context.t0.message,
|
|
149
|
+
status: (_err$response = _context.t0.response) === null || _err$response === void 0 ? void 0 : _err$response.status,
|
|
150
|
+
statusText: (_err$response2 = _context.t0.response) === null || _err$response2 === void 0 ? void 0 : _err$response2.statusText,
|
|
151
|
+
data: (_err$response3 = _context.t0.response) === null || _err$response3 === void 0 ? void 0 : _err$response3.data,
|
|
152
|
+
url: (_err$config = _context.t0.config) === null || _err$config === void 0 ? void 0 : _err$config.url,
|
|
153
|
+
method: (_err$config2 = _context.t0.config) === null || _err$config2 === void 0 ? void 0 : _err$config2.method
|
|
154
|
+
// original: err, // Omit for clean logs, add if you want the raw error for debugging
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
this.emit('error', summary, payload);
|
|
158
|
+
throw summary;
|
|
159
|
+
case 27:
|
|
140
160
|
case "end":
|
|
141
161
|
return _context.stop();
|
|
142
162
|
}
|
|
@@ -78,8 +78,22 @@ export default class RbtMetricsApi extends EventEmitter {
|
|
|
78
78
|
this.emit('sent', payload, res.data);
|
|
79
79
|
return res.data;
|
|
80
80
|
} catch (err) {
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
// Summarize Axios errors for clarity
|
|
82
|
+
let summary = err;
|
|
83
|
+
if (err.isAxiosError) {
|
|
84
|
+
summary = {
|
|
85
|
+
isAxiosError: true,
|
|
86
|
+
message: err.message,
|
|
87
|
+
status: err.response?.status,
|
|
88
|
+
statusText: err.response?.statusText,
|
|
89
|
+
data: err.response?.data,
|
|
90
|
+
url: err.config?.url,
|
|
91
|
+
method: err.config?.method
|
|
92
|
+
// original: err, // Omit for clean logs, add if you want the raw error for debugging
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
this.emit('error', summary, payload);
|
|
96
|
+
throw summary;
|
|
83
97
|
}
|
|
84
98
|
}
|
|
85
99
|
|
package/package.json
CHANGED
package/src/rbt_metrics_api.js
CHANGED
|
@@ -84,8 +84,22 @@ export default class RbtMetricsApi extends EventEmitter {
|
|
|
84
84
|
this.emit('sent', payload, res.data);
|
|
85
85
|
return res.data;
|
|
86
86
|
} catch (err) {
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
// Summarize Axios errors for clarity
|
|
88
|
+
let summary = err;
|
|
89
|
+
if (err.isAxiosError) {
|
|
90
|
+
summary = {
|
|
91
|
+
isAxiosError: true,
|
|
92
|
+
message: err.message,
|
|
93
|
+
status: err.response?.status,
|
|
94
|
+
statusText: err.response?.statusText,
|
|
95
|
+
data: err.response?.data,
|
|
96
|
+
url: err.config?.url,
|
|
97
|
+
method: err.config?.method,
|
|
98
|
+
// original: err, // Omit for clean logs, add if you want the raw error for debugging
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
this.emit('error', summary, payload);
|
|
102
|
+
throw summary;
|
|
89
103
|
}
|
|
90
104
|
}
|
|
91
105
|
|