Skip to content

Commit d3e5fc9

Browse files
ISSUE #315
1 parent 5945d93 commit d3e5fc9

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

packages/plugins/minos-router-graphql/minos/plugins/graphql/decorators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, name: str, output, argument: Optional = None):
2525
self.output = output
2626

2727
def __iter__(self) -> Iterable:
28-
yield from (self.name,)
28+
yield from (type(self), self.name,)
2929

3030

3131
class GraphQlCommandEnrouteDecorator(GraphQlEnrouteDecorator):

packages/plugins/minos-router-graphql/minos/plugins/graphql/handlers.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import logging
21
import traceback
32
from typing import (
43
Any,
@@ -16,6 +15,7 @@
1615
Response,
1716
ResponseException,
1817
)
18+
import logging
1919

2020
logger = logging.getLogger(__name__)
2121

@@ -64,12 +64,15 @@ def _build_response_from_graphql(result: ExecutionResult) -> Response:
6464
if len(errors):
6565
status = 500
6666
for error in errors:
67-
if isinstance(error.original_error, ResponseException):
68-
status = error.original_error.status
69-
error_trace = "".join(traceback.format_tb(error.original_error.__traceback__))
70-
logger.exception(f"Raised a system exception:\n {error_trace}")
67+
if error.original_error is None:
68+
logger.error(f"Raised an graphql exception:\n {error.formatted}")
7169
else:
72-
logger.error(f"Raised an application exception:\n {error}")
70+
71+
if isinstance(error.original_error, ResponseException):
72+
status = error.original_error.status
73+
74+
error_trace = ''.join(traceback.format_tb(error.original_error.__traceback__))
75+
logger.exception(f"Raised a system exception:\n {error_trace}")
7376

7477
content = {"data": result.data, "errors": [err.message for err in errors]}
7578

0 commit comments

Comments
 (0)