Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apollo-server-errors

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-server-errors - npm Package Compare versions

Comparing version 2.0.0-rc.6 to 2.0.0-rc.7

15

dist/index.js

@@ -151,16 +151,3 @@ "use strict";

const { formatter, debug } = options;
const flattenedErrors = [];
errors.forEach(error => {
if (Array.isArray(error.errors)) {
error.errors.forEach(e => flattenedErrors.push(e));
}
else if (error.originalError &&
Array.isArray(error.originalError.errors)) {
error.originalError.errors.forEach(e => flattenedErrors.push(e));
}
else {
flattenedErrors.push(error);
}
});
const enrichedErrors = flattenedErrors.map(error => enrichError(error, debug));
const enrichedErrors = errors.map(error => enrichError(error, debug));
if (!formatter) {

@@ -167,0 +154,0 @@ return enrichedErrors;

4

package.json
{
"name": "apollo-server-errors",
"version": "2.0.0-rc.6",
"version": "2.0.0-rc.7",
"author": "opensource@apollographql.com",

@@ -42,3 +42,3 @@ "license": "MIT",

],
"testRegex": "/__tests__/.*$",
"testRegex": "src/__tests__/.*$",
"globals": {

@@ -45,0 +45,0 @@ "ts-jest": {

@@ -225,26 +225,23 @@ import { GraphQLError } from 'graphql';

const flattenedErrors: Error[] = [];
errors.forEach(error => {
// Errors that occur in graphql-tools can contain an errors array that contains the errors thrown in a merged schema
// https://github.com/apollographql/graphql-tools/blob/3d53986ca/src/stitching/errors.ts#L104-L107
//
// They are are wrapped in an extra GraphQL error
// https://github.com/apollographql/graphql-tools/blob/3d53986ca/src/stitching/errors.ts#L109-L113
// which calls:
// https://github.com/graphql/graphql-js/blob/0a30b62964/src/error/locatedError.js#L18-L37
if (Array.isArray((error as any).errors)) {
(error as any).errors.forEach(e => flattenedErrors.push(e));
} else if (
(error as any).originalError &&
Array.isArray((error as any).originalError.errors)
) {
(error as any).originalError.errors.forEach(e => flattenedErrors.push(e));
} else {
flattenedErrors.push(error);
}
});
// Errors that occur in graphql-tools can contain an errors array that contains the errors thrown in a merged schema
// https://github.com/apollographql/graphql-tools/blob/3d53986ca/src/stitching/errors.ts#L104-L107
//
// They are are wrapped in an extra GraphQL error
// https://github.com/apollographql/graphql-tools/blob/3d53986ca/src/stitching/errors.ts#L109-L113
// which calls:
// https://github.com/graphql/graphql-js/blob/0a30b62964/src/error/locatedError.js#L18-L37
// Some processing for these nested errors could be done here:
//
// if (Array.isArray((error as any).errors)) {
// (error as any).errors.forEach(e => flattenedErrors.push(e));
// } else if (
// (error as any).originalError &&
// Array.isArray((error as any).originalError.errors)
// ) {
// (error as any).originalError.errors.forEach(e => flattenedErrors.push(e));
// } else {
// flattenedErrors.push(error);
// }
const enrichedErrors = flattenedErrors.map(error =>
enrichError(error, debug),
);
const enrichedErrors = errors.map(error => enrichError(error, debug));

@@ -251,0 +248,0 @@ if (!formatter) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc