Socket
Socket
Sign inDemoInstall

apollo-server-errors

Package Overview
Dependencies
2
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.3.1-alpha.0 to 2.3.1

9

dist/index.js

@@ -152,2 +152,9 @@ "use strict";

const enrichedErrors = errors.map(error => enrichError(error, debug));
const makePrintable = error => {
if (error instanceof Error) {
const graphQLError = error;
return Object.assign({ message: graphQLError.message }, (graphQLError.locations && { locations: graphQLError.locations }), (graphQLError.path && { path: graphQLError.path }), (graphQLError.extensions && { extensions: graphQLError.extensions }));
}
return error;
};
if (!formatter) {

@@ -158,3 +165,3 @@ return enrichedErrors;

try {
return formatter(error);
return makePrintable(formatter(error));
}

@@ -161,0 +168,0 @@ catch (err) {

4

package.json
{
"name": "apollo-server-errors",
"version": "2.3.1-alpha.0",
"version": "2.3.1",
"author": "opensource@apollographql.com",

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

},
"gitHead": "ec185a874c2f07b3724db62a3ec8560cfe3850af"
"gitHead": "57210129cda034b095d3f227298021feddda03f7"
}

@@ -246,2 +246,15 @@ import { GraphQLError, GraphQLFormattedError } from 'graphql';

const enrichedErrors = errors.map(error => enrichError(error, debug));
const makePrintable = error => {
if (error instanceof Error) {
// Error defines its `message` and other fields as non-enumerable, meaning JSON.stringigfy does not print them.
const graphQLError = error as GraphQLFormattedError;
return {
message: graphQLError.message,
...(graphQLError.locations && { locations: graphQLError.locations }),
...(graphQLError.path && { path: graphQLError.path }),
...(graphQLError.extensions && { extensions: graphQLError.extensions }),
};
}
return error;
};

@@ -254,3 +267,3 @@ if (!formatter) {

try {
return formatter(error);
return makePrintable(formatter(error));
} catch (err) {

@@ -257,0 +270,0 @@ if (debug) {

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc