Introduce gen_api_error for all API requests
parent
0d9a3a54e1
commit
a3dd645cb7
@ -0,0 +1,12 @@
|
||||
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)),
|
||||
}
|
Loading…
Reference in New Issue