@yolo-croket-dev/core 1.4.47 → 1.4.48

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 logger_1 = __importDefault(require("@yolo-croket-dev/logger"));
6
+ const msa_logger_1 = require("@yolo-croket-dev/msa-logger");
10
7
  const _1 = require(".");
11
- const logger = logger_1.default.createLogger('AmqpHandler');
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, _c;
23
20
  let data;
24
21
  try {
25
22
  data = await (0, rxjs_1.lastValueFrom)(client.send(messagePattern, payload).pipe());
@@ -47,8 +44,21 @@ async function AmqpHandler(client, messagePattern, payload) {
47
44
  }
48
45
  }
49
46
  catch (err) {
50
- logger.error(err);
51
- throw err;
47
+ if (typeof err === 'string' && err.includes('There is no matching message handler defined in the remote service.')) {
48
+ msaLogger.error('NOT_EXISTS_MESSAGE_PATTERN', {
49
+ traceId: ((_b = payload === null || payload === void 0 ? void 0 : payload.param) === null || _b === void 0 ? void 0 : _b.traceId) || '-'
50
+ }, { err });
51
+ throw new HttpExceptionCustom('해당 메시지 패턴은 존재하지 않습니다.', 404, 'There is no matching message handler defined in the remote service.', {
52
+ type: 'NOT_EXISTS_MESSAGE_PATTERN',
53
+ message: '해당 메시지 패턴은 존재하지 않습니다.'
54
+ });
55
+ }
56
+ else {
57
+ msaLogger.error('AMQP_HANDLER_ERROR', {
58
+ traceId: ((_c = payload === null || payload === void 0 ? void 0 : payload.param) === null || _c === void 0 ? void 0 : _c.traceId) || '-'
59
+ }, { err });
60
+ throw err;
61
+ }
52
62
  }
53
63
  delete data.isError;
54
64
  return data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yolo-croket-dev/core",
3
- "version": "1.4.47",
3
+ "version": "1.4.48",
4
4
  "author": "Yolo Co., Ltd.",
5
5
  "description": "Yolo commonization module",
6
6
  "main": "index.js",