mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-14 02:02:20 +03:00
fix: code blocks missing colon
This commit is contained in:
parent
08a42961da
commit
18872ed8d5
|
@ -3,7 +3,7 @@ Custom errors
|
||||||
|
|
||||||
Default GraphQL error format similar to the following snippet
|
Default GraphQL error format similar to the following snippet
|
||||||
|
|
||||||
.. code: json
|
.. code:: json
|
||||||
|
|
||||||
{
|
{
|
||||||
"errors": [
|
"errors": [
|
||||||
|
@ -22,7 +22,8 @@ Default GraphQL error format similar to the following snippet
|
||||||
And there is a way customise it by swapping default ``GraphQLView`` with your own
|
And there is a way customise it by swapping default ``GraphQLView`` with your own
|
||||||
and then override ``format_error`` method
|
and then override ``format_error`` method
|
||||||
|
|
||||||
.. code: python
|
.. code:: python
|
||||||
|
|
||||||
class MyGraphQLView(GraphQLView):
|
class MyGraphQLView(GraphQLView):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def format_error(error) -> Dict[str, Any]:
|
def format_error(error) -> Dict[str, Any]:
|
||||||
|
@ -34,7 +35,8 @@ and then override ``format_error`` method
|
||||||
|
|
||||||
Here is custom formatting function
|
Here is custom formatting function
|
||||||
|
|
||||||
.. code: python
|
.. code:: python
|
||||||
|
|
||||||
def format_error(error: GraphQLError) -> Dict[str, Any]:
|
def format_error(error: GraphQLError) -> Dict[str, Any]:
|
||||||
"""Extract field from ``error`` and return formatted error
|
"""Extract field from ``error`` and return formatted error
|
||||||
:param error: GraphQLError
|
:param error: GraphQLError
|
||||||
|
|
Loading…
Reference in New Issue
Block a user