Skip to content

Commit 96b4f03

Browse files
committed
Adding TransportConnectionFailed Exception to docs
1 parent 43f6f09 commit 96b4f03

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

docs/advanced/error_handling.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ Here are the possible Transport Errors:
4646
If you don't need the schema, you can try to create the client with
4747
:code:`fetch_schema_from_transport=False`
4848

49+
- :class:`TransportConnectionFailed <gql.transport.exceptions.TransportConnectionFailed>`:
50+
This exception is generated when an unexpected Exception is received from the
51+
transport dependency when trying to connect or to send the request.
52+
For example in case of an SSL error, or if a websocket connection suddenly fails.
53+
4954
- :class:`TransportClosed <gql.transport.exceptions.TransportClosed>`:
5055
This exception is generated when the client is trying to use the transport
5156
while the transport was previously closed.

gql/gql.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33

44
def gql(request_string: str) -> GraphQLRequest:
55
"""Given a string containing a GraphQL request,
6-
parse it into a Document and put it into a GraphQLRequest object
6+
parse it into a Document and put it into a GraphQLRequest object.
77
88
:param request_string: the GraphQL request as a String
99
:return: a :class:`GraphQLRequest <gql.GraphQLRequest>`
1010
which can be later executed or subscribed by a
11-
:class:`Client <gql.client.Client>`, by an
12-
:class:`async session <gql.client.AsyncClientSession>` or by a
13-
:class:`sync session <gql.client.SyncClientSession>`
14-
11+
:class:`Client <gql.client.Client>`, by an
12+
:class:`async session <gql.client.AsyncClientSession>` or by a
13+
:class:`sync session <gql.client.SyncClientSession>`
1514
:raises graphql.error.GraphQLError: if a syntax error is encountered.
1615
"""
1716
return GraphQLRequest(request_string)

gql/graphql_request.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,19 @@ def __init__(
1414
variable_values: Optional[Dict[str, Any]] = None,
1515
operation_name: Optional[str] = None,
1616
):
17-
"""
18-
Initialize a GraphQL request.
17+
"""Initialize a GraphQL request.
1918
2019
:param request: GraphQL request as DocumentNode object or as a string.
2120
If string, it will be converted to DocumentNode.
2221
:param variable_values: Dictionary of input parameters (Default: None).
2322
:param operation_name: Name of the operation that shall be executed.
2423
Only required in multi-operation documents (Default: None).
25-
2624
:return: a :class:`GraphQLRequest <gql.GraphQLRequest>`
2725
which can be later executed or subscribed by a
28-
:class:`Client <gql.client.Client>`, by an
29-
:class:`async session <gql.client.AsyncClientSession>` or by a
30-
:class:`sync session <gql.client.SyncClientSession>`
26+
:class:`Client <gql.client.Client>`, by an
27+
:class:`async session <gql.client.AsyncClientSession>` or by a
28+
:class:`sync session <gql.client.SyncClientSession>`
3129
:raises graphql.error.GraphQLError: if a syntax error is encountered.
32-
3330
"""
3431
if isinstance(request, str):
3532
source = Source(request, "GraphQL request")

gql/transport/exceptions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ class TransportClosed(TransportError):
6262

6363

6464
class TransportConnectionFailed(TransportError):
65-
"""Transport adapter connection closed.
65+
"""Transport connection failed.
6666
67-
This exception is by the connection adapter code when a connection closed.
67+
This exception is by the connection adapter code when a connection closed
68+
or if an unexpected Exception was received when trying to send a request.
6869
"""
6970

7071

0 commit comments

Comments
 (0)