Skip to content

Commit

Permalink
Warn on GraphQL parser exceptions (#642)
Browse files Browse the repository at this point in the history
Fix silent parsing failure

When GraphQL `parse` fails to parse a file errors are silently
ignored.

Was having an issue with a whitespace character in one of our
`.graphql` files which was rather difficult to trace.
  • Loading branch information
hekard2l authored and James Baxley committed Nov 14, 2018
1 parent a2029ff commit 9c9b406
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/apollo-codegen-core/src/loading.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ export function loadQueryDocuments(
.map(source => {
try {
return parse(source!);
} catch {
} catch (e) {
const name = (source && source.name) || "";
console.warn(stripIndents`
Warning: error parsing GraphQL file ${name}
${e.stack}`);
return null;
}
})
Expand Down

0 comments on commit 9c9b406

Please sign in to comment.