mirror of
https://github.com/akyaiy/GoSally-mvp.git
synced 2026-01-03 08:32:24 +00:00
fmt
This commit is contained in:
@@ -5,14 +5,14 @@ import "encoding/json"
|
|||||||
func NewError(code int, message string, data any, id *json.RawMessage) *RPCResponse {
|
func NewError(code int, message string, data any, id *json.RawMessage) *RPCResponse {
|
||||||
if data != nil {
|
if data != nil {
|
||||||
return &RPCResponse{
|
return &RPCResponse{
|
||||||
JSONRPC: JSONRPCVersion,
|
JSONRPC: JSONRPCVersion,
|
||||||
ID: id,
|
ID: id,
|
||||||
Error: map[string]any{
|
Error: map[string]any{
|
||||||
"code": code,
|
"code": code,
|
||||||
"message": message,
|
"message": message,
|
||||||
"data": data,
|
"data": data,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return &RPCResponse{
|
return &RPCResponse{
|
||||||
JSONRPC: JSONRPCVersion,
|
JSONRPC: JSONRPCVersion,
|
||||||
|
|||||||
@@ -305,7 +305,7 @@ func (h *HandlerV1) handleLUA(sid string, r *http.Request, req *rpc.RPCRequest,
|
|||||||
rawData := errTbl.RawGetString("data")
|
rawData := errTbl.RawGetString("data")
|
||||||
|
|
||||||
if tbl, ok := rawData.(*lua.LTable); ok {
|
if tbl, ok := rawData.(*lua.LTable); ok {
|
||||||
tbl.ForEach(func(k, v lua.LValue) {data[k.String()] = ConvertLuaTypesToGolang(v)})
|
tbl.ForEach(func(k, v lua.LValue) { data[k.String()] = ConvertLuaTypesToGolang(v) })
|
||||||
} else {
|
} else {
|
||||||
h.x.SLog.Error("the script terminated with an error", slog.String("code", strconv.Itoa(code)), slog.String("message", message))
|
h.x.SLog.Error("the script terminated with an error", slog.String("code", strconv.Itoa(code)), slog.String("message", message))
|
||||||
return rpc.NewError(code, message, rawData, req.ID)
|
return rpc.NewError(code, message, rawData, req.ID)
|
||||||
|
|||||||
Reference in New Issue
Block a user