From 2aa61294a8407051c711182e25148d51c3d08b7b Mon Sep 17 00:00:00 2001 From: Denis Otkidach Date: Mon, 29 Jul 2019 15:50:29 +0300 Subject: [PATCH] Don't log traceback for explicit error response from mutation --- graphql/execution/executor.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/graphql/execution/executor.py b/graphql/execution/executor.py index 14d45c51..ceb37ff3 100644 --- a/graphql/execution/executor.py +++ b/graphql/execution/executor.py @@ -445,12 +445,13 @@ def resolve_or_error( try: return executor.execute(resolve_fn, source, info, **args) except Exception as e: - logger.exception( - "An error occurred while resolving field {}.{}".format( - info.parent_type.name, info.field_name + if not isinstance(e, GraphQLError): + logger.exception( + "An error occurred while resolving field {}.{}".format( + info.parent_type.name, info.field_name + ) ) - ) - e.stack = sys.exc_info()[2] # type: ignore + e.stack = sys.exc_info()[2] # type: ignore return e