@venncity/errors
Advanced tools
Comparing version 1.7.15-add-cwd-param-to-local-env.37 to 1.7.15-fix-validation-errors.110
@@ -39,6 +39,10 @@ "use strict"; | ||
function defaultGatewayErrorFormatter(error) { | ||
var _a; | ||
var _a, _b; | ||
if (((_a = error.extensions) === null || _a === void 0 ? void 0 : _a.code) === 'GRAPHQL_VALIDATION_FAILED') { | ||
return error; | ||
} | ||
if (((_b = error.extensions) === null || _b === void 0 ? void 0 : _b.code) === 'INTERNAL_SERVER_ERROR' && error.name === 'GraphQLError') { | ||
const { message, locations, path } = error; | ||
return { message, locations, path, extensions: {} }; | ||
} | ||
if (error.extensions) { | ||
@@ -50,3 +54,3 @@ // This handles network error returning from service | ||
} | ||
const { message } = error, _b = error.extensions, { serviceName, variables, query, message: errorMessage, statusCode, locations, path } = _b, restOfError = __rest(_b, ["serviceName", "variables", "query", "message", "statusCode", "locations", "path"]); | ||
const { message } = error, _c = error.extensions, { serviceName, variables, query, message: errorMessage, statusCode, locations, path } = _c, restOfError = __rest(_c, ["serviceName", "variables", "query", "message", "statusCode", "locations", "path"]); | ||
// eslint-disable-next-line max-len | ||
@@ -53,0 +57,0 @@ console.info(`returning error response from service ${serviceName} with traceId ${restOfError.traceId} for query ${query} with variables ${fast_safe_stringify_1.default(variables)}`); |
@@ -32,6 +32,10 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
export function defaultGatewayErrorFormatter(error) { | ||
var _a; | ||
var _a, _b; | ||
if (((_a = error.extensions) === null || _a === void 0 ? void 0 : _a.code) === 'GRAPHQL_VALIDATION_FAILED') { | ||
return error; | ||
} | ||
if (((_b = error.extensions) === null || _b === void 0 ? void 0 : _b.code) === 'INTERNAL_SERVER_ERROR' && error.name === 'GraphQLError') { | ||
const { message, locations, path } = error; | ||
return { message, locations, path, extensions: {} }; | ||
} | ||
if (error.extensions) { | ||
@@ -43,3 +47,3 @@ // This handles network error returning from service | ||
} | ||
const { message } = error, _b = error.extensions, { serviceName, variables, query, message: errorMessage, statusCode, locations, path } = _b, restOfError = __rest(_b, ["serviceName", "variables", "query", "message", "statusCode", "locations", "path"]); | ||
const { message } = error, _c = error.extensions, { serviceName, variables, query, message: errorMessage, statusCode, locations, path } = _c, restOfError = __rest(_c, ["serviceName", "variables", "query", "message", "statusCode", "locations", "path"]); | ||
// eslint-disable-next-line max-len | ||
@@ -46,0 +50,0 @@ console.info(`returning error response from service ${serviceName} with traceId ${restOfError.traceId} for query ${query} with variables ${jsonStringify(variables)}`); |
{ | ||
"name": "@venncity/errors", | ||
"version": "1.7.15-add-cwd-param-to-local-env.37+9b05d310c", | ||
"version": "1.7.15-fix-validation-errors.110+4a5643fed", | ||
"author": "Venn Engineering", | ||
@@ -21,3 +21,3 @@ "main": "lib/cjs/index.js", | ||
"@venncity/eslint-config": "^3.0.1", | ||
"@venncity/jest-config-server": "^3.4.1-add-cwd-param-to-local-env.62+9b05d310c", | ||
"@venncity/jest-config-server": "^3.4.0", | ||
"eslint": "^5.5.0", | ||
@@ -35,3 +35,3 @@ "eslint-config-airbnb-base": "^13.1.0", | ||
"dependencies": { | ||
"@venncity/nested-config": "^2.0.23-add-cwd-param-to-local-env.37+9b05d310c", | ||
"@venncity/nested-config": "^2.0.23-fix-validation-errors.110+4a5643fed", | ||
"fast-safe-stringify": "^2.0.7", | ||
@@ -43,3 +43,3 @@ "joi": "^14.3.1", | ||
}, | ||
"gitHead": "9b05d310c43f629a17e8852ed384bc1135a662b8" | ||
"gitHead": "4a5643fed106fd63c29de12e2b0ca2ea19790edc" | ||
} |
@@ -28,2 +28,6 @@ import jsonStringify from 'fast-safe-stringify'; | ||
} | ||
if (error.extensions?.code === 'INTERNAL_SERVER_ERROR' && error.name === 'GraphQLError') { | ||
const { message, locations, path } = error; | ||
return { message, locations, path, extensions: {} }; | ||
} | ||
if (error.extensions) { | ||
@@ -30,0 +34,0 @@ // This handles network error returning from service |
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
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
118371
1827