graphene-django/graphene_django/debug/exception/formating.py
Tim Schilling 5d5d7f1815
Django v4, python 3.10 support for graphene-django v3 (#1281)
Co-authored-by: Yair Silbermintz <MisterGlass@users.noreply.github.com>
2022-01-07 20:26:07 +00:00

18 lines
417 B
Python

import traceback
from django.utils.encoding import force_str
from .types import DjangoDebugException
def wrap_exception(exception):
return DjangoDebugException(
message=force_str(exception),
exc_type=force_str(type(exception)),
stack="".join(
traceback.format_exception(
exception, value=exception, tb=exception.__traceback__
)
),
)