Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
TartifletteError("ATartifletteError"),
["ATartifletteError"],
[type(None)],
),
(TypeError("ATypeError"), ["ATypeError"], [TypeError]),
(
MultipleException(
exceptions=[
TartifletteError("ATartifletteError"),
TypeError("ATypeError"),
]
),
["ATartifletteError", "ATypeError"],
[type(None), TypeError],
),
],
)
:param extensions: Extensions dict to add to the error.
:type message: str
:type nodes: Union[Node, List[Node]]
:type path: Optional[List[str]]
:type original_error: Optional[Exception]
:type extensions: Optional[Dict[str, Any]]
:return: a TartifletteError with locations
:rtype: TartifletteError
"""
if not isinstance(nodes, list):
nodes = [nodes]
if isinstance(path, Path):
path = path.as_list()
return TartifletteError(
message,
locations=[node.location for node in nodes],
path=path,
original_error=original_error,
extensions=extensions,
)
) -> Union["TartifletteError", Exception]:
"""
Converts the raw exception into a TartifletteError if its not coercible or
returns the raw exception if coercible.
:param raw_exception: the raw exception to be treated
:param message: message replacing the raw exception message when it's not
coercible
:type raw_exception: Exception
:type message: Optional[str]
:return: a coercible exception
:rtype: Union["TartifletteError", Exception]
"""
return (
raw_exception
if is_coercible_exception(raw_exception)
else TartifletteError(
message or str(raw_exception), original_error=raw_exception
)
pass
class UnknownDirectiveDefinition(TartifletteError):
pass
class UnknownScalarDefinition(TartifletteError):
pass
class UnknownFieldDefinition(TartifletteError):
pass
class UnknownTypeDefinition(TartifletteError):
pass
class MissingImplementation(ImproperlyConfigured):
pass
class RedefinedImplementation(TartifletteError):
pass
class CoercionError(TartifletteError):
pass
execution_context: ExecutionContext,
raw_exception: Union[Exception, MultipleException],
path: Union[str, List[str]],
location: "Location",
) -> None:
exceptions = (
raw_exception.exceptions
if isinstance(raw_exception, MultipleException)
else [raw_exception]
)
for exception in exceptions:
gql_error = (
exception
if is_coercible_exception(exception)
else TartifletteError(
str(exception), path, [location], original_error=exception
)
)
gql_error.coerce_value = partial(
gql_error.coerce_value, path=path, locations=[location]
)
execution_context.add_error(gql_error)
pass
class UnknownFieldDefinition(TartifletteError):
pass
class UnknownTypeDefinition(TartifletteError):
pass
class MissingImplementation(ImproperlyConfigured):
pass
class RedefinedImplementation(TartifletteError):
pass
class CoercionError(TartifletteError):
pass
async def create_source_event_stream(
self,
execution_ctx: ExecutionContext,
request_ctx: Optional[Dict[str, Any]],
parent_result: Optional[Any] = None,
):
if not self.subscribe:
raise TartifletteError(
"Can't execute a subscription query on a field which doesn't "
"provide a source event stream with < @Subscription >."
)
info = Info(
query_field=self,
schema_field=self.field_executor.schema_field,
schema=self.schema,
path=self.path,
location=self.location,
execution_ctx=execution_ctx,
)
return self.subscribe(
parent_result,
await coerce_arguments(
pass
class NonAwaitableResolver(ImproperlyConfigured):
pass
class NonAsyncGeneratorSubscription(ImproperlyConfigured):
pass
class NotSubscriptionField(ImproperlyConfigured):
pass
class UnknownSchemaFieldResolver(TartifletteError):
pass
class UnknownDirectiveDefinition(TartifletteError):
pass
class UnknownScalarDefinition(TartifletteError):
pass
class UnknownFieldDefinition(TartifletteError):
pass
class UnknownTypeDefinition(TartifletteError):
:type other: MultipleException
:return: a new MultipleException containing both exception list
:rtype: MultipleException
"""
return MultipleException(self.exceptions + other.exceptions)
class ImproperlyConfigured(TartifletteError):
pass
class InvalidType(TartifletteError):
pass
class GraphQLSchemaError(TartifletteError):
pass
class GraphQLSyntaxError(TartifletteError):
pass
class NonCallable(ImproperlyConfigured):
pass
class NonCoroutine(ImproperlyConfigured):
pass
class NonAwaitableResolver(ImproperlyConfigured):