From 8c8aa1069a5232a4e4d7f61fdbac609504bc879d Mon Sep 17 00:00:00 2001 From: snoop Date: Fri, 9 Jun 2017 18:33:51 +0900 Subject: [PATCH] added error --- gateway/services.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/gateway/services.go b/gateway/services.go index 552b265..49f29b8 100644 --- a/gateway/services.go +++ b/gateway/services.go @@ -61,6 +61,8 @@ func (s *ServiceImpl) ExecServices(c context.Context, in *pb.ServiceInput) (*pb. // Check Service Name serviceName, ok := g_services[in.ServiceName] + log.Println("Service Name : " + in.ServiceName + " MethodName : " + in.MethodName) + if !ok { return nil, errors.New("Not Exist Service Name") @@ -82,7 +84,20 @@ func (s *ServiceImpl) ExecServices(c context.Context, in *pb.ServiceInput) (*pb. } // Todo Call Service Method - result := methodName.Call(params)[0].String() + results := methodName.Call(params); + + result := results[0].Interface().(string) + + var err error = nil; + if len(result) > 1 { + obj := results[1].Interface() + if obj != nil { + log.Println("err : " + err.Error()) + err = obj.(error) + return pbs, err + } + } + pbs.ResultStr = result