Skip to content

Commit

Permalink
fix fatal in joinArgumentDefinitions
Browse files Browse the repository at this point in the history
Reviewed By: josephsavona

Differential Revision: D21190974

fbshipit-source-id: 52fd2eb8d4bc6514728c65fb778c7d9c9e2025d7
  • Loading branch information
kassens authored and facebook-github-bot committed Apr 23, 2020
1 parent 564310d commit 85b44e7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/relay-compiler/util/joinArgumentDefinitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,17 @@ function joinArgumentDefinition(
} else if (schema.isTypeSubTypeOf(prevArgDef.type, nextArgDef.type)) {
return prevArgDef;
} else {
const prevArgType =
prevArgDef.type != null
? schema.getTypeString(prevArgDef.type)
: 'unknown';
const nextArgType =
nextArgDef.type != null
? schema.getTypeString(nextArgDef.type)
: 'unknown';
throw createUserError(
'Cannot combine variables with incompatible types ' +
`${schema.getTypeString(prevArgDef.type)} and ${schema.getTypeString(
nextArgDef.type,
)} ` +
`${prevArgType} and ${nextArgType} ` +
`when applying ${directiveName}.`,
[prevArgDef.loc, nextArgDef.loc],
);
Expand Down

0 comments on commit 85b44e7

Please sign in to comment.