Skip to content

Commit

Permalink
fix: adjust error logic
Browse files Browse the repository at this point in the history
  • Loading branch information
andy89923 committed Apr 23, 2024
1 parent 553fd76 commit ccbf197
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backend/WebUI/api_verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit ccbf197

Please sign in to comment.