@venncity/errors
Advanced tools
Comparing version 1.7.27 to 1.7.28-lambda-middleware.80
@@ -19,5 +19,7 @@ "use strict"; | ||
const fast_safe_stringify_1 = __importDefault(require("fast-safe-stringify")); | ||
const cls_hooked_1 = __importDefault(require("cls-hooked")); | ||
const formatError_1 = require("../formatError/formatError"); | ||
const config = require('@venncity/nested-config')(__dirname); | ||
function defaultServiceErrorFormatter(error) { | ||
setErrorOnNamespace(error); | ||
const originalError = error.originalError; | ||
@@ -32,2 +34,8 @@ const body = formatError_1.handleErrorThrown(originalError); | ||
exports.defaultServiceErrorFormatter = defaultServiceErrorFormatter; | ||
function setErrorOnNamespace(error) { | ||
const namespace = cls_hooked_1.default.getNamespace(config.get('clsNamespace.sequelize')); | ||
if (namespace) { | ||
namespace.set('error', error); | ||
} | ||
} | ||
// It is expected from the service response to contain the message and the error metadata inside extensions object | ||
@@ -34,0 +42,0 @@ function wrapResponseForGateway(body) { |
@@ -13,5 +13,7 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
import jsonStringify from 'fast-safe-stringify'; | ||
import cls from 'cls-hooked'; | ||
import { handleErrorThrown } from '../formatError/formatError'; | ||
const config = require('@venncity/nested-config')(__dirname); | ||
export function defaultServiceErrorFormatter(error) { | ||
setErrorOnNamespace(error); | ||
const originalError = error.originalError; | ||
@@ -25,2 +27,8 @@ const body = handleErrorThrown(originalError); | ||
} | ||
function setErrorOnNamespace(error) { | ||
const namespace = cls.getNamespace(config.get('clsNamespace.sequelize')); | ||
if (namespace) { | ||
namespace.set('error', error); | ||
} | ||
} | ||
// It is expected from the service response to contain the message and the error metadata inside extensions object | ||
@@ -27,0 +35,0 @@ function wrapResponseForGateway(body) { |
{ | ||
"name": "@venncity/errors", | ||
"version": "1.7.27", | ||
"version": "1.7.28-lambda-middleware.80+76cbc9990", | ||
"author": "Venn Engineering", | ||
@@ -36,4 +36,5 @@ "main": "lib/cjs/index.js", | ||
"@sentry/types": "^5.22.3", | ||
"@venncity/nested-config": "^2.0.35", | ||
"@venncity/nested-config": "^2.0.36-lambda-middleware.80+76cbc9990", | ||
"@venncity/schema-consts": "^4.1.8", | ||
"cls-hooked": "^4.2.2", | ||
"fast-safe-stringify": "^2.0.7", | ||
@@ -45,3 +46,3 @@ "joi": "^14.3.1", | ||
}, | ||
"gitHead": "2071ce6c245a39411385b3512aaa49f833bc3407" | ||
"gitHead": "76cbc999066d2a3545b7e137ef92674c3e8ca8c8" | ||
} |
import jsonStringify from 'fast-safe-stringify'; | ||
import cls from 'cls-hooked'; | ||
import { handleErrorThrown } from '../formatError/formatError'; | ||
@@ -7,2 +8,3 @@ | ||
export function defaultServiceErrorFormatter(error) { | ||
setErrorOnNamespace(error); | ||
const originalError = error.originalError; | ||
@@ -17,2 +19,9 @@ const body = handleErrorThrown(originalError); | ||
function setErrorOnNamespace(error) { | ||
const namespace = cls.getNamespace(config.get('clsNamespace.sequelize')); | ||
if (namespace) { | ||
namespace.set('error', error); | ||
} | ||
} | ||
// It is expected from the service response to contain the message and the error metadata inside extensions object | ||
@@ -19,0 +28,0 @@ function wrapResponseForGateway(body) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
217130
93
3479
10
2
1
+ Addedcls-hooked@^4.2.2
+ Added@venncity/nested-config@2.0.36-lambda-middleware.80(transitive)
- Removed@venncity/nested-config@2.0.35(transitive)
Updated@venncity/nested-config@^2.0.36-lambda-middleware.80+76cbc9990