From be7c93a840d814041ba9108ba6fd4a191ea392cc Mon Sep 17 00:00:00 2001 From: Sashko Stubailo Date: Fri, 6 May 2016 09:55:50 -0700 Subject: [PATCH 1/3] Add docs URL to error message --- src/queries/getFromAST.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/queries/getFromAST.ts b/src/queries/getFromAST.ts index b38731a75af..85a0434e541 100644 --- a/src/queries/getFromAST.ts +++ b/src/queries/getFromAST.ts @@ -6,7 +6,7 @@ import { export function getMutationDefinition(doc: Document): OperationDefinition { if (doc.kind !== 'Document') { - throw new Error('Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag?'); + throw new Error('Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'); } if (doc.definitions.length > 1) { @@ -24,7 +24,7 @@ export function getMutationDefinition(doc: Document): OperationDefinition { export function getQueryDefinition(doc: Document): OperationDefinition { if (doc.kind !== 'Document') { - throw new Error('Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag?'); + throw new Error('Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'); } if (doc.definitions.length > 1) { @@ -42,7 +42,7 @@ export function getQueryDefinition(doc: Document): OperationDefinition { export function getFragmentDefinition(doc: Document): FragmentDefinition { if (doc.kind !== 'Document') { - throw new Error('Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag?'); + throw new Error('Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'); } if (doc.definitions.length > 1) { From accb01a88026f3965e2d4240e6515bfe1e1f8681 Mon Sep 17 00:00:00 2001 From: Sashko Stubailo Date: Tue, 10 May 2016 12:30:44 -0700 Subject: [PATCH 2/3] Fix line length lint --- src/queries/getFromAST.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/queries/getFromAST.ts b/src/queries/getFromAST.ts index 85a0434e541..ba21841182a 100644 --- a/src/queries/getFromAST.ts +++ b/src/queries/getFromAST.ts @@ -6,7 +6,8 @@ import { export function getMutationDefinition(doc: Document): OperationDefinition { if (doc.kind !== 'Document') { - throw new Error('Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'); + throw new Error(`Expecting a parsed GraphQL document. Perhaps you need to wrap the query \ +string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql`); } if (doc.definitions.length > 1) { @@ -24,7 +25,8 @@ export function getMutationDefinition(doc: Document): OperationDefinition { export function getQueryDefinition(doc: Document): OperationDefinition { if (doc.kind !== 'Document') { - throw new Error('Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'); + throw new Error(`Expecting a parsed GraphQL document. Perhaps you need to wrap the query \ +string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql`); } if (doc.definitions.length > 1) { @@ -42,7 +44,8 @@ export function getQueryDefinition(doc: Document): OperationDefinition { export function getFragmentDefinition(doc: Document): FragmentDefinition { if (doc.kind !== 'Document') { - throw new Error('Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'); + throw new Error(`Expecting a parsed GraphQL document. Perhaps you need to wrap the query \ +string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql`); } if (doc.definitions.length > 1) { From d74bc33c9b455db362fa55998651a8841ea74106 Mon Sep 17 00:00:00 2001 From: Sashko Stubailo Date: Tue, 10 May 2016 12:33:10 -0700 Subject: [PATCH 3/3] Add to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49324fea97a..a02181952ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Expect active development and potentially significant breaking changes in the `0 ### vNEXT +- Improve error message when a dev forgets `gql` to link to docs. [PR #181](https://github.com/apollostack/apollo-client/pull/181) - ...