lambda-essentials-ts 5.2.0 → 5.2.2

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6
6
 
7
+ ## [5.2.2] - 2023-08-25
8
+
9
+ ### Added
10
+
11
+ HttpClient now also logs unexpected (e.g. network) errors that are not coming from Axios
12
+
7
13
  ## [5.2.0] - 2023-06-08
8
14
 
9
15
  ### Added
@@ -40,6 +40,10 @@ class OpenApiWrapper {
40
40
  this.userPrincipal = this.notSet;
41
41
  this.requestId = this.notSet;
42
42
  this.correlationId = this.notSet;
43
+ if (config === null || config === void 0 ? void 0 : config.enableNewRelicTracking) {
44
+ // eslint-disable-next-line global-require
45
+ this.newrelic = require('newrelic');
46
+ }
43
47
  // @ts-ignore Later Use the options Type from OpenApiFactory
44
48
  this.api = new openapi_factory_1.default({
45
49
  requestMiddleware: async (request) => {
@@ -68,9 +72,6 @@ class OpenApiWrapper {
68
72
  query: request.multiValueQueryStringParameters,
69
73
  });
70
74
  if (config === null || config === void 0 ? void 0 : config.enableNewRelicTracking) {
71
- if (!this.newrelic) {
72
- this.newrelic = await Promise.resolve().then(() => __importStar(require('newrelic')));
73
- }
74
75
  this.newrelic.addCustomAttributes({
75
76
  canonicalId: this.userPrincipal,
76
77
  correlationId,
package/lib/util.js CHANGED
@@ -45,7 +45,10 @@ exports.serializeObject = serializeObject;
45
45
  function serializeAxiosError(error) {
46
46
  var _a;
47
47
  if (!error.response) {
48
- return undefined;
48
+ return {
49
+ status: 500,
50
+ details: error,
51
+ };
49
52
  }
50
53
  const { status, data } = error.response;
51
54
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambda-essentials-ts",
3
- "version": "5.2.0",
3
+ "version": "5.2.2",
4
4
  "description": "A selection of the finest modules supporting authorization, API routing, error handling, logging and sending HTTP requests.",
5
5
  "main": "lib/index.js",
6
6
  "private": false,