@yolo-croket-dev/core 1.4.47-jun.8 → 1.4.47
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,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.AmqpHandler = exports.HttpExceptionCustom = void 0;
|
|
4
7
|
const common_1 = require("@nestjs/common");
|
|
5
8
|
const rxjs_1 = require("rxjs");
|
|
6
|
-
const
|
|
9
|
+
const logger_1 = __importDefault(require("@yolo-croket-dev/logger"));
|
|
7
10
|
const _1 = require(".");
|
|
8
|
-
const
|
|
11
|
+
const logger = logger_1.default.createLogger('AmqpHandler');
|
|
9
12
|
class HttpExceptionCustom extends common_1.HttpException {
|
|
10
13
|
constructor(response, status, subMessage, errInfo) {
|
|
11
14
|
super(response, status);
|
|
@@ -16,7 +19,7 @@ class HttpExceptionCustom extends common_1.HttpException {
|
|
|
16
19
|
exports.HttpExceptionCustom = HttpExceptionCustom;
|
|
17
20
|
// eslint-disable-next-line max-len
|
|
18
21
|
async function AmqpHandler(client, messagePattern, payload) {
|
|
19
|
-
var _a
|
|
22
|
+
var _a;
|
|
20
23
|
let data;
|
|
21
24
|
try {
|
|
22
25
|
data = await (0, rxjs_1.lastValueFrom)(client.send(messagePattern, payload).pipe());
|
|
@@ -44,18 +47,8 @@ async function AmqpHandler(client, messagePattern, payload) {
|
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
49
|
catch (err) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (err === 'There is no matching message handler defined in the remote service.') {
|
|
50
|
-
// throw new BadRequest('NOT_EXISTS_SERVICE', 'There is no matching message handler defined in the remote service');
|
|
51
|
-
throw new Error('test');
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
msaLogger.error('AMQP_HANDLER_ERROR', {
|
|
55
|
-
traceId: ((_b = payload === null || payload === void 0 ? void 0 : payload.param) === null || _b === void 0 ? void 0 : _b.traceId) || '-'
|
|
56
|
-
});
|
|
57
|
-
throw err;
|
|
58
|
-
}
|
|
50
|
+
logger.error(err);
|
|
51
|
+
throw err;
|
|
59
52
|
}
|
|
60
53
|
delete data.isError;
|
|
61
54
|
return data;
|