Skip to content

Commit

Permalink
fix: formatGraphQLErrors helper for persisted queries
Browse files Browse the repository at this point in the history
  • Loading branch information
nodkz committed Aug 19, 2020
1 parent f24cb95 commit a9a036f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ node_modules
/es
/lib
/node8
/mjs

coverage
.nyc_output
6 changes: 3 additions & 3 deletions src/createRequestError.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ export function formatGraphQLErrors(request: RelayRequest, errors: GraphQLRespon
return errors.join('\n');
}

let queryLines = [];
const queryString = request.getQueryString();
if (!queryString) {
if (queryString) {
// When using persisted query, queryString is an empty string.
return errors.join('\n');
queryLines = queryString.split('\n');
}

const queryLines = queryString.split('\n');
return errors
.map(({ locations, message }, ii) => {
const prefix = `${ii + 1}. `;
Expand Down

0 comments on commit a9a036f

Please sign in to comment.