added error

This commit is contained in:
snoop 2017-06-09 18:33:51 +09:00
parent a8cc8008db
commit 8c8aa1069a

View File

@ -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