From ccbf1973fe236c66594d3c41b39313c933c03e19 Mon Sep 17 00:00:00 2001 From: "CTFang@WireLab" <ctfang.cs12@nycu.edu.tw> Date: Mon, 22 Apr 2024 07:21:29 +0000 Subject: [PATCH] fix: adjust error logic --- backend/WebUI/api_verify.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/WebUI/api_verify.go b/backend/WebUI/api_verify.go index 220e3d5..27ad8eb 100644 --- a/backend/WebUI/api_verify.go +++ b/backend/WebUI/api_verify.go @@ -8,7 +8,6 @@ import ( "github.com/gin-gonic/gin" "go.mongodb.org/mongo-driver/bson" - "go.mongodb.org/mongo-driver/mongo" "github.com/free5gc/openapi/models" smf_factory "github.com/free5gc/smf/pkg/factory" @@ -175,12 +174,14 @@ func VerifyStaticIP(c *gin.Context) { "ueId": bson.D{{Key: "$ne", Value: checkData.Supi}}, // not this UE } smDataDataInterface, mongo_err := mongoapi.RestfulAPIGetMany(smDataColl, filter) - if mongo_err != nil && mongo_err != mongo.ErrNoDocuments { + if mongo_err != nil { + logger.ProcLog.Warningln(smDataColl, "mongo error: ", mongo_err) c.JSON(http.StatusInternalServerError, gin.H{ "ipaddr": staticIp, "valid": false, "cause": mongo_err.Error(), }) + return } var smDatas []models.SessionManagementSubscriptionData if err := json.Unmarshal(sliceToByte(smDataDataInterface), &smDatas); err != nil { -- GitLab