Skip to content

Commit

Permalink
enable mypy checking on dagit (#7626)
Browse files Browse the repository at this point in the history
  • Loading branch information
smackesey committed Apr 28, 2022
1 parent 6e52818 commit 8ab7bfb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from .utils import get_python_versions_for_branch

MYPY_EXCLUDES = [
"python_modules/dagit",
"python_modules/automation",
"python_modules/libraries/dagster-databricks",
"python_modules/libraries/dagster-dbt",
Expand Down
10 changes: 5 additions & 5 deletions python_modules/dagit/dagit/format_error.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from typing import Any, Dict
from typing import Dict

from graphql.error.base import GraphQLError

from dagster.utils.log import get_stack_trace_array


# based on default_format_error copied and pasted from graphql_server 1.1.1
def format_error_with_stack_trace(error: Exception) -> Dict[str, Any]:
formatted_error = {"message": str(error)} # type: Dict[str, Any]
def format_error_with_stack_trace(error: BaseException) -> Dict[str, object]:
formatted_error: Dict[str, object] = {"message": str(error)}

if isinstance(error, GraphQLError):
if error.locations is not None:
Expand All @@ -19,8 +19,8 @@ def format_error_with_stack_trace(error: Exception) -> Dict[str, Any]:

# this is what is different about this implementation
# we print out stack traces to ease debugging
if hasattr(error, "original_error") and error.original_error:
formatted_error["stack_trace"] = get_stack_trace_array(error.original_error)
if hasattr(error, "original_error") and error.original_error: # type: ignore [attr-defined]
formatted_error["stack_trace"] = get_stack_trace_array(error.original_error) # type: ignore [attr-defined]
else:
formatted_error["stack_trace"] = get_stack_trace_array(error)

Expand Down

0 comments on commit 8ab7bfb

Please sign in to comment.