From f4508a84236a4aff1c7b5bfa17a14a8ff95728ba Mon Sep 17 00:00:00 2001
From: yinbentan <yinbentan@live.com>
Date: 星期一, 08 七月 2024 09:45:10 +0800
Subject: [PATCH] 接口调用报错处理

---
 proto/user/server.go |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/proto/user/server.go b/proto/user/server.go
index 70fb15a..b1f6971 100644
--- a/proto/user/server.go
+++ b/proto/user/server.go
@@ -2,11 +2,15 @@
 
 import (
 	"context"
+	"errors"
 	"wms/pkg/logx"
 	"wms/proto/init_client"
 )
 
 func GetUserList() ([]*GetUserRequest, error) {
+	if init_client.AdminConn == nil {
+		return nil, errors.New("grpc.ClientConnInterface AdminConn is nil")
+	}
 	cli := NewUserServiceClient(init_client.AdminConn)
 	list, err := cli.GetUserList(context.Background(), &GetUserRequest{})
 	if err != nil {

--
Gitblit v1.8.0