@mablhq/mabl-cli 2.70.4 → 2.70.10
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/api/mablApiClient.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.MablApiClient = void 0;
|
|
7
7
|
const ApiError_1 = require("./ApiError");
|
|
8
8
|
const env_1 = require("../env/env");
|
|
9
|
+
const axios_1 = __importDefault(require("axios"));
|
|
9
10
|
const mablApi_1 = require("../mablApi");
|
|
10
11
|
const cliConfigProvider_1 = require("../providers/cliConfigProvider");
|
|
11
12
|
const basicApiClient_1 = require("./basicApiClient");
|
|
@@ -1127,13 +1128,19 @@ function sortTemporallyDescending(entities) {
|
|
|
1127
1128
|
entities.sort((a, b) => b.created_time - a.created_time);
|
|
1128
1129
|
}
|
|
1129
1130
|
function toApiError(summary, cause) {
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1131
|
+
if (cause instanceof ApiError_1.ApiError) {
|
|
1132
|
+
return cause;
|
|
1133
|
+
}
|
|
1134
|
+
if (axios_1.default.isAxiosError(cause)) {
|
|
1135
|
+
const errorResponse = cause.response;
|
|
1136
|
+
const code = errorResponse?.status;
|
|
1137
|
+
const mablError = errorResponse?.data;
|
|
1138
|
+
const message = `${summary}: ${mablError
|
|
1139
|
+
? `${mablError.code}: ${mablError.message} (${mablError.id})`
|
|
1140
|
+
: cause.toString()}`;
|
|
1141
|
+
return new ApiError_1.ApiError(message, code, cause);
|
|
1142
|
+
}
|
|
1143
|
+
return new ApiError_1.ApiError(summary, undefined, cause);
|
|
1137
1144
|
}
|
|
1138
1145
|
function createTimeSeriesMetricMeasurement(type, numberValue, options) {
|
|
1139
1146
|
return {
|