feat: 添加全局错误日志捕获

- Python 侧 _dispatch 异常时输出完整堆栈到 stderr
- Go 侧 handler 返回 error 时打印日志
- 升级 Python 包版本至 0.1.4
This commit is contained in:
2026-05-20 19:30:52 +08:00
parent 16261a8c8f
commit db71a904e0
3 changed files with 6 additions and 1 deletions

View File

@@ -46,7 +46,9 @@ import queue
import signal
import socket
import struct
import sys
import threading
import traceback
from typing import Any, Callable, TypeVar
T = TypeVar("T")
@@ -346,6 +348,7 @@ def _dispatch(mux: _ConnMux, msg: dict):
pass # ctx 取消,连接已被 Go 侧关闭,无需回写
except Exception as e:
traceback.print_exc(file=sys.stderr)
mux.write({"id": msg_id, "type": "error", "error": str(e)})
finally:

View File

@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "gobridge"
version = "0.1.3"
version = "0.1.4"
description = "Python 端库,配合 Go 侧 gobridge 使用"
requires-python = ">=3.10"