clan-app: Move json.loads to try catch

This commit is contained in:
Qubasa
2025-07-08 17:38:24 +07:00
parent 876a90cfc3
commit 26710c0aca
2 changed files with 9 additions and 6 deletions

View File

@@ -43,10 +43,11 @@ class WebviewBridge(ApiBridge):
arg: int,
) -> None:
"""Handle a call from webview's JavaScript bridge."""
try:
op_key = op_key_bytes.decode()
raw_args = json.loads(request_data.decode())
try:
# Parse the webview-specific request format
header = {}
args = {}
@@ -74,6 +75,8 @@ class WebviewBridge(ApiBridge):
)
except Exception as e:
msg = f"Error while handling webview call {method_name} with op_key {op_key_bytes}"
log.exception(msg)
self.send_error_response(op_key, str(e), ["webview_bridge", method_name])
return