Skip to content

Add extensions property to GraphQLError. #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion graphql/error/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from ..language.source import Source
from ..language.location import SourceLocation
from types import TracebackType
from typing import Optional, List, Any, Union
from typing import Optional, List, Any, Union, Dict


class GraphQLError(Exception):
Expand All @@ -30,6 +30,7 @@ def __init__(
positions=None, # type: Optional[Any]
locations=None, # type: Optional[Any]
path=None, # type: Union[List[Union[int, str]], List[str], None]
extensions=None # type: Optional[Dict[str, Any]]
):
# type: (...) -> None
super(GraphQLError, self).__init__(message)
Expand All @@ -40,6 +41,7 @@ def __init__(
self._positions = positions
self._locations = locations
self.path = path
self.extensions = extensions
return None

@property
Expand Down
2 changes: 2 additions & 0 deletions graphql/error/format_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ def format_error(error):
]
if error.path is not None:
formatted_error["path"] = error.path
if error.extensions is not None:
formatted_error["extensions"] = error.extensions

return formatted_error