MCPcopy Create free account
hub / github.com/apache/dubbo-go / callLocalMethod

Function callLocalMethod

proxy/proxy_factory/utils.go:30–57  ·  view source on GitHub ↗

CallLocalMethod is used to handle invoke exception in user func.

(method reflect.Method, in []reflect.Value)

Source from the content-addressed store, hash-verified

28
29// CallLocalMethod is used to handle invoke exception in user func.
30func callLocalMethod(method reflect.Method, in []reflect.Value) ([]reflect.Value, error) {
31 var (
32 returnValues []reflect.Value
33 retErr error
34 )
35
36 func() {
37 defer func() {
38 if e := recover(); e != nil {
39 if err, ok := e.(error); ok {
40 retErr = err
41 } else if err, ok := e.(string); ok {
42 retErr = perrors.New(err)
43 } else {
44 retErr = fmt.Errorf("invoke function error, unknow exception: %+v", e)
45 }
46 }
47 }()
48
49 returnValues = method.Func.Call(in)
50 }()
51
52 if retErr != nil {
53 return nil, retErr
54 }
55
56 return returnValues, retErr
57}

Callers 3

TestCallLocalMethodFunction · 0.85
InvokeMethod · 0.85
InvokeMethod · 0.85

Calls 2

CallMethod · 0.80
ErrorfMethod · 0.65

Tested by 1

TestCallLocalMethodFunction · 0.68