From 0510d817da1fadf1e577e74e83d16eb706143972 Mon Sep 17 00:00:00 2001 From: Benjie Gillam Date: Wed, 26 Mar 2025 09:28:23 +0000 Subject: [PATCH 1/3] Crisp up the wording around error handling clients --- packages/plugins/typescript/operations/src/config.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/plugins/typescript/operations/src/config.ts b/packages/plugins/typescript/operations/src/config.ts index 9a575099289..a68de8003f6 100644 --- a/packages/plugins/typescript/operations/src/config.ts +++ b/packages/plugins/typescript/operations/src/config.ts @@ -297,8 +297,14 @@ export interface TypeScriptDocumentsPluginConfig extends RawDocumentsConfig { * @description Options related to handling nullability * @exampleMarkdown * ## `errorHandlingClient` + * An error handling client is a client which prevents the user from reading a `null` used as a placeholder for an error in a GraphQL response. + * The client may do so by throwing when an errored field is accessed (as is the case for `graphql-toe`), + * or when a fragment containing an error is read (as is the case for Relay's `@throwOnFieldError` directive), + * or by preventing any data from being read if an error occurred (as with Apollo's `errorPolicy: "none"`). + * * When using error handling clients, a semantic non-nullable field can never be `null`. - * If a field is read and its value is `null`, there must be a respective error. The error handling client will throw in this case, so the `null` value is never read. + * If a semantic non-nullable field's value in the response is `null`, there must be a respective error. + * The error handling client will throw in this case, so the `null` value is never read. * * To enable this option, install `graphql-sock` peer dependency: * From ebab71a9b9fc11d93aae4fedf444f09ce42996ef Mon Sep 17 00:00:00 2001 From: Benjie Date: Wed, 26 Mar 2025 12:46:17 +0000 Subject: [PATCH 2/3] Update packages/plugins/typescript/operations/src/config.ts Co-authored-by: Eddy Nguyen --- packages/plugins/typescript/operations/src/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugins/typescript/operations/src/config.ts b/packages/plugins/typescript/operations/src/config.ts index a68de8003f6..ed1deaf4abc 100644 --- a/packages/plugins/typescript/operations/src/config.ts +++ b/packages/plugins/typescript/operations/src/config.ts @@ -300,7 +300,7 @@ export interface TypeScriptDocumentsPluginConfig extends RawDocumentsConfig { * An error handling client is a client which prevents the user from reading a `null` used as a placeholder for an error in a GraphQL response. * The client may do so by throwing when an errored field is accessed (as is the case for `graphql-toe`), * or when a fragment containing an error is read (as is the case for Relay's `@throwOnFieldError` directive), - * or by preventing any data from being read if an error occurred (as with Apollo's `errorPolicy: "none"`). + * or by preventing any data from being read if an error occurred (as with Apollo Client's `errorPolicy: "none"`). * * When using error handling clients, a semantic non-nullable field can never be `null`. * If a semantic non-nullable field's value in the response is `null`, there must be a respective error. From f1501585f59ee003f1a2db3b94c427f80cb24250 Mon Sep 17 00:00:00 2001 From: Benjie Date: Wed, 26 Mar 2025 12:47:00 +0000 Subject: [PATCH 3/3] Add link to graphql-toe --- packages/plugins/typescript/operations/src/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugins/typescript/operations/src/config.ts b/packages/plugins/typescript/operations/src/config.ts index ed1deaf4abc..ec83928eecc 100644 --- a/packages/plugins/typescript/operations/src/config.ts +++ b/packages/plugins/typescript/operations/src/config.ts @@ -298,7 +298,7 @@ export interface TypeScriptDocumentsPluginConfig extends RawDocumentsConfig { * @exampleMarkdown * ## `errorHandlingClient` * An error handling client is a client which prevents the user from reading a `null` used as a placeholder for an error in a GraphQL response. - * The client may do so by throwing when an errored field is accessed (as is the case for `graphql-toe`), + * The client may do so by throwing when an errored field is accessed (as is the case for [`graphql-toe`](https://github.com/graphile/graphql-toe)), * or when a fragment containing an error is read (as is the case for Relay's `@throwOnFieldError` directive), * or by preventing any data from being read if an error occurred (as with Apollo Client's `errorPolicy: "none"`). *