badmfck-api-server 4.0.83 → 4.0.85
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.
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
@@ -6,7 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
29
|
exports.MicroserviceClient = exports.REQ_MICROSERVICE_CALL = void 0;
|
|
7
30
|
const badmfck_signal_1 = require("badmfck-signal");
|
|
8
31
|
const BaseService_1 = require("../BaseService");
|
|
9
|
-
const DefaultErrors_1 =
|
|
32
|
+
const DefaultErrors_1 = __importStar(require("../structures/DefaultErrors"));
|
|
10
33
|
const Http_1 = require("../http/Http");
|
|
11
34
|
const crypto_1 = __importDefault(require("crypto"));
|
|
12
35
|
const TimeframeService_1 = require("../TimeframeService");
|
|
@@ -67,8 +90,12 @@ class MicroserviceClient extends BaseService_1.BaseService {
|
|
|
67
90
|
}
|
|
68
91
|
return { ...DefaultErrors_1.default.EXTERNAL_SERVICE_ERROR, details: "Network connection lost after multiple retries, attempts: " + attempt };
|
|
69
92
|
}
|
|
70
|
-
if (!resp.ok)
|
|
93
|
+
if (!resp.ok) {
|
|
94
|
+
const remoteError = resp.error?.error;
|
|
95
|
+
if (DefaultErrors_1.ErrorUtils.isError(remoteError))
|
|
96
|
+
return remoteError;
|
|
71
97
|
return { ...DefaultErrors_1.default.BAD_REQUEST, stack: [resp.error], details: resp.details };
|
|
98
|
+
}
|
|
72
99
|
const body = resp.data;
|
|
73
100
|
const isAccepted = body?.error?.code === DefaultErrors_1.default.ACCEPTED.code || body?.code === DefaultErrors_1.default.ACCEPTED.code;
|
|
74
101
|
if (isAccepted) {
|
|
@@ -116,7 +116,9 @@ class MicroserviceHost extends BaseService_1.BaseService {
|
|
|
116
116
|
return result;
|
|
117
117
|
}
|
|
118
118
|
catch (e) {
|
|
119
|
-
const
|
|
119
|
+
const errText = e instanceof Error ? e.message : "unknown error: " + e;
|
|
120
|
+
const errStack = e instanceof Error && e.stack ? e.stack : "";
|
|
121
|
+
const err = DefaultErrors_1.ErrorUtils.isError(e) ? e : { ...DefaultErrors_1.default.INTERNAL_ERROR, details: errText, stack: errStack };
|
|
120
122
|
job.status = "completed";
|
|
121
123
|
job.result = err;
|
|
122
124
|
return job.result;
|