|
34 | 34 | from .utilities import build_client_schema
|
35 | 35 | from .utilities import parse_result as parse_result_fn
|
36 | 36 | from .utilities import serialize_variable_values
|
| 37 | +from .utils import str_first_element |
37 | 38 |
|
38 | 39 | """
|
39 | 40 | Load the appropriate instance of the Literal type
|
@@ -152,7 +153,8 @@ def _build_schema_from_introspection(self, execution_result: ExecutionResult):
|
152 | 153 | if execution_result.errors:
|
153 | 154 | raise TransportQueryError(
|
154 | 155 | (
|
155 |
| - f"Error while fetching schema: {execution_result.errors[0]!s}\n" |
| 156 | + "Error while fetching schema: " |
| 157 | + f"{str_first_element(execution_result.errors)}\n" |
156 | 158 | "If you don't need the schema, you can try with: "
|
157 | 159 | '"fetch_schema_from_transport=False"'
|
158 | 160 | ),
|
@@ -858,7 +860,7 @@ def execute(
|
858 | 860 | # Raise an error if an error is returned in the ExecutionResult object
|
859 | 861 | if result.errors:
|
860 | 862 | raise TransportQueryError(
|
861 |
| - str(result.errors[0]), |
| 863 | + str_first_element(result.errors), |
862 | 864 | errors=result.errors,
|
863 | 865 | data=result.data,
|
864 | 866 | extensions=result.extensions,
|
@@ -1066,7 +1068,7 @@ async def subscribe(
|
1066 | 1068 | # Raise an error if an error is returned in the ExecutionResult object
|
1067 | 1069 | if result.errors:
|
1068 | 1070 | raise TransportQueryError(
|
1069 |
| - str(result.errors[0]), |
| 1071 | + str_first_element(result.errors), |
1070 | 1072 | errors=result.errors,
|
1071 | 1073 | data=result.data,
|
1072 | 1074 | extensions=result.extensions,
|
@@ -1229,7 +1231,7 @@ async def execute(
|
1229 | 1231 | # Raise an error if an error is returned in the ExecutionResult object
|
1230 | 1232 | if result.errors:
|
1231 | 1233 | raise TransportQueryError(
|
1232 |
| - str(result.errors[0]), |
| 1234 | + str_first_element(result.errors), |
1233 | 1235 | errors=result.errors,
|
1234 | 1236 | data=result.data,
|
1235 | 1237 | extensions=result.extensions,
|
|
0 commit comments