From 88441b2d0ea13075b221d0d22332ad1295619cb8 Mon Sep 17 00:00:00 2001 From: Vladimir Razuvaev Date: Mon, 16 Oct 2017 23:06:38 +0700 Subject: [PATCH] Deployed 57f5ee3 with MkDocs version: 0.16.3 --- error-handling/index.html | 4 ++-- index.html | 2 +- mkdocs/search_index.json | 4 ++-- sitemap.xml | 40 +++++++++++++++++++-------------------- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/error-handling/index.html b/error-handling/index.html index bb01108..d4784fd 100755 --- a/error-handling/index.html +++ b/error-handling/index.html @@ -325,8 +325,8 @@ $myErrorHandler = function(array $errors, callable $formatter) { $result = GraphQL::executeQuery(/* $args */) ->setErrorFormatter($myErrorFormatter) - ->setErrorHandler($myErrorHandler) - ->toArray(); + ->setErrorsHandler($myErrorHandler) + ->toArray();

Note that when you pass debug flags to toArray() your custom formatter will still be diff --git a/index.html b/index.html index b1f9a2f..406ba54 100755 --- a/index.html +++ b/index.html @@ -280,5 +280,5 @@ existing PHP frameworks, add support for Relay, etc.

diff --git a/mkdocs/search_index.json b/mkdocs/search_index.json index 78b825e..10f7272 100755 --- a/mkdocs/search_index.json +++ b/mkdocs/search_index.json @@ -407,7 +407,7 @@ }, { "location": "/error-handling/", - "text": "Errors in GraphQL\n\n\nQuery execution process never throws exceptions. Instead, all errors are caught and collected. \nAfter execution, they are available in \n$errors\n prop of \n\nGraphQL\\Executor\\ExecutionResult\n.\n\n\nWhen the result is converted to a serializable array using its \ntoArray()\n method, all errors are \nconverted to arrays as well using default error formatting (see below). \n\n\nAlternatively, you can apply \ncustom error filtering and formatting\n\nfor your specific requirements.\n\n\nDefault Error formatting\n\n\nBy default, each error entry is converted to an associative array with following structure:\n\n\n 'Error message',\n 'category' => 'graphql',\n 'locations' => [\n ['line' => 1, 'column' => 2]\n ],\n 'path' => [\n 'listField',\n 0,\n 'fieldWithException'\n ]\n];\n\n\n\n\nEntry at key \nlocations\n points to a character in query string which caused the error.\nIn some cases (like deep fragment fields) locations will include several entries to track down \nthe path to field with the error in query.\n\n\nEntry at key \npath\n exists only for errors caused by exceptions thrown in resolvers. \nIt contains a path from the very root field to actual field value producing an error \n(including indexes for list types and field names for composite types). \n\n\nInternal errors\n\n\nAs of version \n0.10.0\n, all exceptions thrown in resolvers are reported with generic message \n\"Internal server error\"\n.\nThis is done to avoid information leak in production environments (e.g. database connection errors, file access errors, etc).\n\n\nOnly exceptions implementing interface \nGraphQL\\Error\\ClientAware\n and claiming themselves as \nsafe\n will \nbe reported with a full error message.\n\n\nFor example:\n\n\n 'My reported error',\n 'category' => 'businessLogic',\n 'locations' => [\n ['line' => 10, 'column' => 2]\n ],\n 'path' => [\n 'path',\n 'to',\n 'fieldWithException'\n ]\n];\n\n\n\n\nTo change default \n\"Internal server error\"\n message to something else, use: \n\n\nGraphQL\\Error\\FormattedError::setInternalErrorMessage(\"Unexpected error\");\n\n\n\n\nDebugging tools\n\n\nDuring development or debugging use \n$result->toArray(true)\n to add \ndebugMessage\n key to \neach formatted error entry. If you also want to add exception trace - pass flags instead:\n\n\nuse GraphQL\\Error\\Debug;\n$debug = Debug::INCLUDE_DEBUG_MESSAGE | Debug::INCLUDE_TRACE;\n$result = GraphQL::executeQuery(/*args*/)->toArray($debug);\n\n\n\n\nThis will make each error entry to look like this:\n\n\n 'Actual exception message',\n 'message' => 'Internal server error',\n 'category' => 'internal',\n 'locations' => [\n ['line' => 10, 'column' => 2]\n ],\n 'path' => [\n 'listField',\n 0,\n 'fieldWithException'\n ],\n 'trace' => [\n /* Formatted original exception trace */\n ]\n];\n\n\n\n\nIf you prefer first resolver exception to be re-thrown, use following flags:\n\n\ntoArray($debug); \n\n\n\n\nCustom Error Handling and Formatting\n\n\nIt is possible to define custom \nformatter\n and \nhandler\n for result errors.\n\n\nFormatter\n is responsible for converting instances of \nGraphQL\\Error\\Error\n \nto an array. \nHandler\n is useful for error filtering and logging. \n\n\nFor example, these are default formatter and handler:\n\n\nsetErrorFormatter($myErrorFormatter)\n ->setErrorHandler($myErrorHandler)\n ->toArray();\n\n\n\n\nNote that when you pass \ndebug flags\n to \ntoArray()\n your custom formatter will still be \ndecorated with same debugging information mentioned above.\n\n\nSchema Errors\n\n\nSo far we only covered errors which occur during query execution process. But schema definition can \nalso throw \nGraphQL\\Error\\InvariantViolation\n if there is an error in one of type definitions.\n\n\nUsually such errors mean that there is some logical error in your schema and it is the only case \nwhen it makes sense to return \n500\n error code for GraphQL endpoint:\n\n\n [FormattedError::createFromException($e)]\n ];\n $status = 500;\n}\n\nheader('Content-Type: application/json', true, $status);\necho json_encode($body);", + "text": "Errors in GraphQL\n\n\nQuery execution process never throws exceptions. Instead, all errors are caught and collected. \nAfter execution, they are available in \n$errors\n prop of \n\nGraphQL\\Executor\\ExecutionResult\n.\n\n\nWhen the result is converted to a serializable array using its \ntoArray()\n method, all errors are \nconverted to arrays as well using default error formatting (see below). \n\n\nAlternatively, you can apply \ncustom error filtering and formatting\n\nfor your specific requirements.\n\n\nDefault Error formatting\n\n\nBy default, each error entry is converted to an associative array with following structure:\n\n\n 'Error message',\n 'category' => 'graphql',\n 'locations' => [\n ['line' => 1, 'column' => 2]\n ],\n 'path' => [\n 'listField',\n 0,\n 'fieldWithException'\n ]\n];\n\n\n\n\nEntry at key \nlocations\n points to a character in query string which caused the error.\nIn some cases (like deep fragment fields) locations will include several entries to track down \nthe path to field with the error in query.\n\n\nEntry at key \npath\n exists only for errors caused by exceptions thrown in resolvers. \nIt contains a path from the very root field to actual field value producing an error \n(including indexes for list types and field names for composite types). \n\n\nInternal errors\n\n\nAs of version \n0.10.0\n, all exceptions thrown in resolvers are reported with generic message \n\"Internal server error\"\n.\nThis is done to avoid information leak in production environments (e.g. database connection errors, file access errors, etc).\n\n\nOnly exceptions implementing interface \nGraphQL\\Error\\ClientAware\n and claiming themselves as \nsafe\n will \nbe reported with a full error message.\n\n\nFor example:\n\n\n 'My reported error',\n 'category' => 'businessLogic',\n 'locations' => [\n ['line' => 10, 'column' => 2]\n ],\n 'path' => [\n 'path',\n 'to',\n 'fieldWithException'\n ]\n];\n\n\n\n\nTo change default \n\"Internal server error\"\n message to something else, use: \n\n\nGraphQL\\Error\\FormattedError::setInternalErrorMessage(\"Unexpected error\");\n\n\n\n\nDebugging tools\n\n\nDuring development or debugging use \n$result->toArray(true)\n to add \ndebugMessage\n key to \neach formatted error entry. If you also want to add exception trace - pass flags instead:\n\n\nuse GraphQL\\Error\\Debug;\n$debug = Debug::INCLUDE_DEBUG_MESSAGE | Debug::INCLUDE_TRACE;\n$result = GraphQL::executeQuery(/*args*/)->toArray($debug);\n\n\n\n\nThis will make each error entry to look like this:\n\n\n 'Actual exception message',\n 'message' => 'Internal server error',\n 'category' => 'internal',\n 'locations' => [\n ['line' => 10, 'column' => 2]\n ],\n 'path' => [\n 'listField',\n 0,\n 'fieldWithException'\n ],\n 'trace' => [\n /* Formatted original exception trace */\n ]\n];\n\n\n\n\nIf you prefer first resolver exception to be re-thrown, use following flags:\n\n\ntoArray($debug); \n\n\n\n\nCustom Error Handling and Formatting\n\n\nIt is possible to define custom \nformatter\n and \nhandler\n for result errors.\n\n\nFormatter\n is responsible for converting instances of \nGraphQL\\Error\\Error\n \nto an array. \nHandler\n is useful for error filtering and logging. \n\n\nFor example, these are default formatter and handler:\n\n\nsetErrorFormatter($myErrorFormatter)\n ->setErrorsHandler($myErrorHandler)\n ->toArray(); \n\n\n\n\nNote that when you pass \ndebug flags\n to \ntoArray()\n your custom formatter will still be \ndecorated with same debugging information mentioned above.\n\n\nSchema Errors\n\n\nSo far we only covered errors which occur during query execution process. But schema definition can \nalso throw \nGraphQL\\Error\\InvariantViolation\n if there is an error in one of type definitions.\n\n\nUsually such errors mean that there is some logical error in your schema and it is the only case \nwhen it makes sense to return \n500\n error code for GraphQL endpoint:\n\n\n [FormattedError::createFromException($e)]\n ];\n $status = 500;\n}\n\nheader('Content-Type: application/json', true, $status);\necho json_encode($body);", "title": "Handling Errors" }, { @@ -427,7 +427,7 @@ }, { "location": "/error-handling/#custom-error-handling-and-formatting", - "text": "It is possible to define custom formatter and handler for result errors. Formatter is responsible for converting instances of GraphQL\\Error\\Error \nto an array. Handler is useful for error filtering and logging. For example, these are default formatter and handler: setErrorFormatter($myErrorFormatter)\n ->setErrorHandler($myErrorHandler)\n ->toArray(); Note that when you pass debug flags to toArray() your custom formatter will still be \ndecorated with same debugging information mentioned above.", + "text": "It is possible to define custom formatter and handler for result errors. Formatter is responsible for converting instances of GraphQL\\Error\\Error \nto an array. Handler is useful for error filtering and logging. For example, these are default formatter and handler: setErrorFormatter($myErrorFormatter)\n ->setErrorsHandler($myErrorHandler)\n ->toArray(); Note that when you pass debug flags to toArray() your custom formatter will still be \ndecorated with same debugging information mentioned above.", "title": "Custom Error Handling and Formatting" }, { diff --git a/sitemap.xml b/sitemap.xml index aaa6db7..7f64afa 100755 --- a/sitemap.xml +++ b/sitemap.xml @@ -4,7 +4,7 @@ / - 2017-09-29 + 2017-10-16 daily @@ -12,7 +12,7 @@ /getting-started/ - 2017-09-29 + 2017-10-16 daily @@ -20,7 +20,7 @@ /complementary-tools/ - 2017-09-29 + 2017-10-16 daily @@ -29,67 +29,67 @@ /type-system/ - 2017-09-29 + 2017-10-16 daily /type-system/object-types/ - 2017-09-29 + 2017-10-16 daily /type-system/scalar-types/ - 2017-09-29 + 2017-10-16 daily /type-system/enum-types/ - 2017-09-29 + 2017-10-16 daily /type-system/lists-and-nonnulls/ - 2017-09-29 + 2017-10-16 daily /type-system/interfaces/ - 2017-09-29 + 2017-10-16 daily /type-system/unions/ - 2017-09-29 + 2017-10-16 daily /type-system/input-types/ - 2017-09-29 + 2017-10-16 daily /type-system/directives/ - 2017-09-29 + 2017-10-16 daily /type-system/schema/ - 2017-09-29 + 2017-10-16 daily /type-system/type-language/ - 2017-09-29 + 2017-10-16 daily @@ -98,7 +98,7 @@ /executing-queries/ - 2017-09-29 + 2017-10-16 daily @@ -106,7 +106,7 @@ /data-fetching/ - 2017-09-29 + 2017-10-16 daily @@ -114,7 +114,7 @@ /error-handling/ - 2017-09-29 + 2017-10-16 daily @@ -122,7 +122,7 @@ /security/ - 2017-09-29 + 2017-10-16 daily @@ -130,7 +130,7 @@ /how-it-works/ - 2017-09-29 + 2017-10-16 daily @@ -138,7 +138,7 @@ /reference/ - 2017-09-29 + 2017-10-16 daily