This commit is contained in:
Star 2024-10-01 08:40:14 +08:00
parent eddfed2284
commit 055a61f191

View File

@ -251,6 +251,8 @@ func _makeJsValue(ctx *plugin.Context, in interface{}, n int, key string, plugin
//}
outs := make([]reflect.Value, 0)
jsResult := jsCtx.Invoke(jsFunc, jsCtx.Null(), ins...)
defer jsResult.Free()
// make error return
if !jsResult.IsUndefined() {
if funcType.NumOut() == 1 {
out0P := reflect.New(funcType.Out(0)).Interface()
@ -418,6 +420,10 @@ func _makeFromJsValue(in quickjs.Value, parent quickjs.Value, key string, n int,
return []byte{}
}
return buf
} else if in.IsError() {
return in.Error()
} else if in.IsException() {
return in.Context().Exception()
} else if in.IsArray() {
a := make([]interface{}, 0)
//isBytes := true
@ -509,8 +515,8 @@ func _makeFromJsValue(in quickjs.Value, parent quickjs.Value, key string, n int,
} else {
jsOut = jsCtx.Invoke(in, jsCtx.Null(), jsIn...)
}
defer jsOut.Free()
out := MakeFromJsValue(jsOut, ctx)
jsOut.Free()
return out
}
} else if in.IsObject() {