From f421af92525c9873360a574606ceac4367f8516f Mon Sep 17 00:00:00 2001 From: smallnest Date: Fri, 24 Nov 2023 11:45:52 +0800 Subject: [PATCH] #829 prior to use service error --- server/plugin.go | 2 +- server/server.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/server/plugin.go b/server/plugin.go index 85f8d27f..3bc1114d 100644 --- a/server/plugin.go +++ b/server/plugin.go @@ -315,7 +315,7 @@ func (p *pluginContainer) DoPreCall(ctx context.Context, serviceName, methodName // DoPostCall invokes PostCallPlugin plugin. func (p *pluginContainer) DoPostCall(ctx context.Context, serviceName, methodName string, args, reply interface{}, err error) (interface{}, error) { - e := err + var e error for i := range p.plugins { if plugin, ok := p.plugins[i].(PostCallPlugin); ok { reply, e = plugin.PostCall(ctx, serviceName, methodName, args, reply, err) diff --git a/server/server.go b/server/server.go index c792602f..d19f6ca1 100644 --- a/server/server.go +++ b/server/server.go @@ -825,7 +825,10 @@ func (s *Server) handleRequestForFunction(ctx context.Context, req *protocol.Mes err = service.callForFunction(ctx, mtype, reflect.ValueOf(argv), reflect.ValueOf(replyv)) } - replyv, err = s.Plugins.DoPostCall(ctx, serviceName, methodName, argv, replyv, err) + replyv, err1 := s.Plugins.DoPostCall(ctx, serviceName, methodName, argv, replyv, err) + if err == nil { + err = err1 + } reflectTypePools.Put(mtype.ArgType, argv) if err != nil {