@emartech/json-logger 9.0.1 → 9.1.0

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.
@@ -29,5 +29,6 @@ export declare class Logger {
29
29
  private shortenData;
30
30
  private getErrorDetails;
31
31
  private getBaseErrorDetails;
32
+ private extractError;
32
33
  private getAxiosErrorDetails;
33
34
  }
@@ -126,17 +126,22 @@ class Logger {
126
126
  };
127
127
  }
128
128
  return {
129
- error: {
130
- type: error.name,
131
- message: error.message,
132
- context: this.shortenData(error.data),
133
- stack_trace: this.shortenStackTrace(error.stack || ''),
134
- },
129
+ error: this.extractError(error),
135
130
  event: {
136
131
  reason: error.message,
137
132
  },
138
133
  };
139
134
  }
135
+ extractError(error) {
136
+ const shortenedData = this.shortenData(error.data);
137
+ return {
138
+ type: error.name,
139
+ message: error.message,
140
+ ...(shortenedData && { context: shortenedData }),
141
+ stack_trace: this.shortenStackTrace(error.stack || ''),
142
+ ...(error.cause instanceof Error && { cause: this.extractError(error.cause) }),
143
+ };
144
+ }
140
145
  getAxiosErrorDetails(error) {
141
146
  if (!error.isAxiosError) {
142
147
  return {};
package/package.json CHANGED
@@ -9,8 +9,8 @@
9
9
  "scripts": {
10
10
  "test": "mocha --require ts-node/register --extension ts ./src --recursive",
11
11
  "test:watch": "mocha --require ts-node/register --extension ts ./src --recursive --watch",
12
- "lint": "eslint .",
13
- "lint:fix": "eslint . --fix",
12
+ "lint": "cross-env ESLINT_USE_FLAT_CONFIG=false eslint .",
13
+ "lint:fix": "cross-env ESLINT_USE_FLAT_CONFIG=false eslint . --fix",
14
14
  "build": "rm -rf dist && tsc --project ./tsconfig.json",
15
15
  "release": "CI=true semantic-release",
16
16
  "example-js": "DEBUG=* node examples/index-js.js",
@@ -42,17 +42,18 @@
42
42
  "lodash": "^4.17.21"
43
43
  },
44
44
  "devDependencies": {
45
- "@types/chai": "4.3.20",
45
+ "@types/chai": "5.2.2",
46
46
  "@types/lodash": "4.17.20",
47
47
  "@types/mocha": "10.0.10",
48
48
  "@types/node": "20.19.22",
49
49
  "@types/sinon": "17.0.4",
50
- "@types/sinon-chai": "3.2.12",
50
+ "@types/sinon-chai": "4.0.0",
51
51
  "@typescript-eslint/eslint-plugin": "8.46.1",
52
52
  "@typescript-eslint/parser": "8.46.1",
53
53
  "axios": "1.12.2",
54
- "chai": "4.5.0",
55
- "eslint": "8.57.1",
54
+ "chai": "6.2.0",
55
+ "cross-env": "10.1.0",
56
+ "eslint": "9.38.0",
56
57
  "eslint-config-emarsys": "5.1.0",
57
58
  "eslint-config-prettier": "10.1.8",
58
59
  "eslint-plugin-chai-friendly": "1.1.0",
@@ -63,9 +64,9 @@
63
64
  "prettier": "3.6.2",
64
65
  "semantic-release": "24.2.9",
65
66
  "sinon": "21.0.0",
66
- "sinon-chai": "3.7.0",
67
+ "sinon-chai": "4.0.1",
67
68
  "ts-node": "10.9.2",
68
69
  "typescript": "5.9.3"
69
70
  },
70
- "version": "9.0.1"
71
+ "version": "9.1.0"
71
72
  }