@naturalcycles/backend-lib 4.17.2 → 4.17.4

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.
@@ -53,6 +53,9 @@ function respondWithError(req, res, err) {
53
53
  delete httpError.stack;
54
54
  httpError.data.errorId = errorId;
55
55
  httpError.data.backendResponseStatusCode ||= 500; // default to 500
56
+ // httpStatusCode is for backwards-compatibility
57
+ // Otherwise, it breaks the _isHttpErrorResponse function check, and error get formatted/detected wrongly
58
+ httpError.data['httpStatusCode'] = httpError.data.backendResponseStatusCode;
56
59
  httpError.data.headersSent = headersSent || undefined;
57
60
  httpError.data.report ||= undefined; // set to undefined if false
58
61
  (0, js_lib_1._filterUndefinedValues)(httpError.data, true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/backend-lib",
3
- "version": "4.17.2",
3
+ "version": "4.17.4",
4
4
  "scripts": {
5
5
  "prepare": "husky install && patch-package",
6
6
  "serve": "APP_ENV=dev nodemon",
@@ -86,6 +86,9 @@ export function respondWithError(req: BackendRequest, res: BackendResponse, err:
86
86
 
87
87
  httpError.data.errorId = errorId
88
88
  httpError.data.backendResponseStatusCode ||= 500 // default to 500
89
+ // httpStatusCode is for backwards-compatibility
90
+ // Otherwise, it breaks the _isHttpErrorResponse function check, and error get formatted/detected wrongly
91
+ httpError.data['httpStatusCode'] = httpError.data.backendResponseStatusCode
89
92
  httpError.data.headersSent = headersSent || undefined
90
93
  httpError.data.report ||= undefined // set to undefined if false
91
94
  _filterUndefinedValues(httpError.data, true)