mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-02-12 17:40:35 +03:00
18 lines
429 B
Python
18 lines
429 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(
|
||
|
etype=type(exception), value=exception, tb=exception.__traceback__
|
||
|
)
|
||
|
),
|
||
|
)
|