@graphql-tools/delegate 7.1.3-alpha-1a132cb3.0 → 7.1.5

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.
package/es5/index.cjs.js CHANGED
@@ -190,17 +190,24 @@ function mergeExternalObjects(schema, path, typeName, target, sources, selection
190
190
  var results = [];
191
191
  var errors = [];
192
192
  sources.forEach(function (source, index) {
193
- if (source instanceof graphql.GraphQLError || source === null) {
193
+ if (source instanceof Error || source === null) {
194
194
  var selectionSet = selectionSets[index];
195
- var fieldNodes = utils.collectFields({
195
+ var fieldNodes_1 = utils.collectFields({
196
196
  schema: schema,
197
197
  variableValues: {},
198
198
  fragments: {},
199
199
  }, schema.getType(typeName), selectionSet, Object.create(null), Object.create(null));
200
200
  var nullResult_1 = {};
201
- Object.keys(fieldNodes).forEach(function (responseKey) {
202
- nullResult_1[responseKey] =
203
- source instanceof graphql.GraphQLError ? utils.relocatedError(source, path.concat([responseKey])) : null;
201
+ Object.keys(fieldNodes_1).forEach(function (responseKey) {
202
+ if (source instanceof graphql.GraphQLError) {
203
+ nullResult_1[responseKey] = utils.relocatedError(source, path.concat([responseKey]));
204
+ }
205
+ else if (source instanceof Error) {
206
+ nullResult_1[responseKey] = graphql.locatedError(source, fieldNodes_1[responseKey], path.concat([responseKey]));
207
+ }
208
+ else {
209
+ nullResult_1[responseKey] = null;
210
+ }
204
211
  });
205
212
  results.push(nullResult_1);
206
213
  }