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

@@ -6,6 +6,7 @@ import (
"context"
"encoding/json"
"fmt"
"log"
"net"
"reflect"
"sync"
@@ -105,6 +106,7 @@ func readResult(ctx context.Context, conn net.Conn, pool Pool, write func(Messag
result, errStr := pool.callbackDispatch(ctx, msg)
var resp Message
if errStr != "" {
log.Printf("gobridge: handler %s error: %s", msg.Method, errStr)
resp = Message{ID: msg.ID, Type: TypeError, Error: errStr}
} else {
data, _ := json.Marshal(result)