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