Clan-app/api: add traceback for all underlying exceptions
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import json
|
||||
import logging
|
||||
import traceback
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
@@ -107,6 +108,7 @@ class WebExecutor(GObject.Object):
|
||||
)
|
||||
return
|
||||
|
||||
try:
|
||||
# Initialize dataclasses from the payload
|
||||
reconciled_arguments = {}
|
||||
for k, v in data.items():
|
||||
@@ -121,6 +123,22 @@ class WebExecutor(GObject.Object):
|
||||
reconciled_arguments[k] = from_dict(arg_class, v)
|
||||
|
||||
GLib.idle_add(fn_instance.internal_async_run, reconciled_arguments)
|
||||
except Exception as e:
|
||||
self.return_data_to_js(
|
||||
method_name,
|
||||
json.dumps(
|
||||
{
|
||||
"op_key": data["op_key"],
|
||||
"status": "error",
|
||||
"errors": [
|
||||
{
|
||||
"message": "Internal API Error",
|
||||
"description": traceback.format_exception(e),
|
||||
}
|
||||
],
|
||||
}
|
||||
),
|
||||
)
|
||||
|
||||
def on_result(self, source: ImplFunc, data: GResult) -> None:
|
||||
result = dataclass_to_dict(data.result)
|
||||
|
||||
Reference in New Issue
Block a user