From 3725da4bf84cd895e54df236cff1e2bf0a88ea18 Mon Sep 17 00:00:00 2001 From: Jeremy Walker Date: Wed, 18 Mar 2020 10:41:39 -0700 Subject: [PATCH 1/2] Added resolver-returned value to the error object, plus further documentation on expected error fields (#590) --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 388b8fdc..5f61826d 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,12 @@ The `graphqlHTTP` function accepts the following options: errors produced by fulfilling a GraphQL operation. If no function is provided, GraphQL's default spec-compliant [`formatError`][] function will be used. + Although the fields on the error provided to this function may vary (based on the error type), they will typically include: + * **message:** the error message + * **locations:** the location(s) in the Javascript code where the error ocurred + * **path:** the path within the returned results where the error occurred (eg. in a schema violation error, the path to the part of the results that violated the schema) + * **result:** the value which was returned by the resolver (if any) + - **`customParseFn`**: An optional function which will be used to create a document instead of the default `parse` from `graphql-js`. From 0cdd645301f69aa771ba774c2093180628177140 Mon Sep 17 00:00:00 2001 From: Jeremy Walker Date: Mon, 1 Jun 2020 08:35:28 -0700 Subject: [PATCH 2/2] Prettified readme --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5f61826d..9a3da93b 100644 --- a/README.md +++ b/README.md @@ -119,10 +119,11 @@ The `graphqlHTTP` function accepts the following options: provided, GraphQL's default spec-compliant [`formatError`][] function will be used. Although the fields on the error provided to this function may vary (based on the error type), they will typically include: - * **message:** the error message - * **locations:** the location(s) in the Javascript code where the error ocurred - * **path:** the path within the returned results where the error occurred (eg. in a schema violation error, the path to the part of the results that violated the schema) - * **result:** the value which was returned by the resolver (if any) + + - **message:** the error message + - **locations:** the location(s) in the Javascript code where the error ocurred + - **path:** the path within the returned results where the error occurred (eg. in a schema violation error, the path to the part of the results that violated the schema) + - **result:** the value which was returned by the resolver (if any) - **`customParseFn`**: An optional function which will be used to create a document instead of the default `parse` from `graphql-js`.