Skip to content

Commit

Permalink
fix: dereg problemdetail
Browse files Browse the repository at this point in the history
  • Loading branch information
andy89923 committed Aug 5, 2024
1 parent 2babd69 commit 151f18b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions internal/sbi/consumer/nrf_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
"github.com/free5gc/openapi/models"
Nnrf_NFDiscovery "github.com/free5gc/openapi/nrf/NFDiscovery"
Nnrf_NFManagement "github.com/free5gc/openapi/nrf/NFManagement"

Check failure on line 16 in internal/sbi/consumer/nrf_service.go

View workflow job for this annotation

GitHub Actions / lint (1.21)

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/free5gc) --custom-order (gci)
"github.com/free5gc/openapi"
)

type nnrfService struct {
Expand Down Expand Up @@ -95,7 +97,7 @@ func (s *nnrfService) SendSearchNFInstances(
return &result, nil
}

func (s *nnrfService) SendDeregisterNFInstance() (problemDetails *models.ProblemDetails, err error) {
func (s *nnrfService) SendDeregisterNFInstance() (*models.ProblemDetails, error) {
logger.ConsumerLog.Infof("Send Deregister NFInstance")

ctx, pd, err := chf_context.GetSelf().GetTokenCtx(models.ServiceName_NNRF_NFM, models.NrfNfManagementNfType_NRF)
Expand All @@ -110,8 +112,14 @@ func (s *nnrfService) SendDeregisterNFInstance() (problemDetails *models.Problem
}

_, err = client.NFInstanceIDDocumentApi.DeregisterNFInstance(ctx, request)

return problemDetails, err
if apiErr, ok := err.(openapi.GenericOpenAPIError); ok {
// API error
if deregNfError, okDeg := apiErr.Model().(Nnrf_NFManagement.DeregisterNFInstanceError); okDeg {
return &deregNfError.ProblemDetails, err
}
return nil, err
}
return nil, err
}

func (s *nnrfService) RegisterNFInstance(ctx context.Context) (
Expand Down

0 comments on commit 151f18b

Please sign in to comment.