@sipgate/integration-bridge 0.15.2 → 0.15.3

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,2 +1,2 @@
1
1
  import { AxiosError } from "axios";
2
- export declare const throwAndDelegateError: (error: Error | AxiosError, source: string, apiKey?: string) => never;
2
+ export declare const throwAndDelegateError: (error: Error | AxiosError, source: string, apiKey?: string, logMessage?: string) => never;
@@ -4,14 +4,19 @@ exports.throwAndDelegateError = void 0;
4
4
  const axios_1 = require("axios");
5
5
  const models_1 = require("../models");
6
6
  const logger_util_1 = require("./logger.util");
7
- const throwAndDelegateError = (error, source, apiKey) => {
7
+ const throwAndDelegateError = (error, source, apiKey, logMessage) => {
8
8
  var _a, _b, _c;
9
- const message = error instanceof axios_1.AxiosError
9
+ const errorMessage = error instanceof axios_1.AxiosError
10
10
  ? ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data)
11
11
  ? JSON.stringify((_b = error.response) === null || _b === void 0 ? void 0 : _b.data)
12
12
  : error.message
13
13
  : error.message;
14
- (0, logger_util_1.errorLogger)(source, message, apiKey);
14
+ if (logMessage) {
15
+ (0, logger_util_1.errorLogger)(source, logMessage, apiKey, errorMessage);
16
+ }
17
+ else {
18
+ (0, logger_util_1.errorLogger)(source, errorMessage, apiKey);
19
+ }
15
20
  if (error instanceof axios_1.AxiosError) {
16
21
  const status = ((_c = error.response) === null || _c === void 0 ? void 0 : _c.status) || 500;
17
22
  var errorType;
@@ -31,7 +36,7 @@ const throwAndDelegateError = (error, source, apiKey) => {
31
36
  errorType = models_1.IntegrationErrorType.INTEGRATION_ERROR_UNAVAILABLE;
32
37
  break;
33
38
  default:
34
- throw new models_1.ServerError(status, `${source} (${message})`);
39
+ throw new models_1.ServerError(status, `${source} (${errorMessage})`);
35
40
  }
36
41
  throw new models_1.ServerError(models_1.DELEGATE_TO_FRONTEND_CODE, errorType);
37
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"error.js","s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,CAAC,6BAA6B,CAAC;gBAC/D,MAAM;YACR;gBACE,MAAM,IAAI,oBAAW,CAAC,MAAM,EAAE,GAAG,MAAM,KAAK,YAAY,GAAG,CAAC,CAAC;SAChE;QACD,MAAM,IAAI,oBAAW,CAAC,kCAAyB,EAAE,SAAS,CAAC,CAAC;KAC7D;IACD,MAAM,IAAI,oBAAW,CAAC,GAAG,EAAE,4BAA4B,CAAC,CAAC;AAC3D,CAAC,CAAC;AA3CW,QAAA,qBAAqB,yBA2ChC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sipgate/integration-bridge",
3
- "version": "0.15.2",
3
+ "version": "0.15.3",
4
4
  "description": "sipgate Integration Bridge Framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",