You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
278 B
Python
13 lines
278 B
Python
1 year ago
|
from __future__ import annotations
|
||
|
|
||
|
from traceback import format_exception
|
||
|
from typing import Dict
|
||
|
|
||
|
|
||
|
def gen_api_error(exc: Exception) -> Dict:
|
||
|
return {
|
||
|
"type": repr(type(exc)),
|
||
|
"args": repr(exc.args),
|
||
|
"traceback": list(format_exception(exc)),
|
||
|
}
|