Skip to content

Commit

Permalink
fix: panic when no record found
Browse files Browse the repository at this point in the history
  • Loading branch information
andy89923 committed Oct 31, 2024
1 parent 0891e79 commit f4bfcea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var (
CtxLog *logrus.Entry
SBILog *logrus.Entry
ConsumerLog *logrus.Entry
ProcLog *logrus.Entry
GinLog *logrus.Entry
ChargingdataPostLog *logrus.Entry
NotifyEventLog *logrus.Entry
Expand All @@ -43,6 +44,7 @@ func init() {
CtxLog = NfLog.WithField(logger_util.FieldCategory, "CTX")
SBILog = NfLog.WithField(logger_util.FieldCategory, "SBI")
ConsumerLog = NfLog.WithField(logger_util.FieldCategory, "Consumer")
ProcLog = NfLog.WithField(logger_util.FieldCategory, "Proc")
GinLog = NfLog.WithField(logger_util.FieldCategory, "GIN")
ChargingdataPostLog = NfLog.WithField(logger_util.FieldCategory, "ChargingPost")
NotifyEventLog = NfLog.WithField(logger_util.FieldCategory, "NotifyEvent")
Expand Down
5 changes: 5 additions & 0 deletions internal/sbi/processor/cdr.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package processor

import (
"fmt"
"strings"
"time"

Expand Down Expand Up @@ -202,6 +203,10 @@ func (p *Processor) OpenCDR(
func (p *Processor) UpdateCDR(
record *cdrType.CHFRecord, chargingData models.ChfConvergedChargingChargingDataRequest,
) error {
if record == nil {
return fmt.Errorf("CHFRecord is nil")
}

// map SBI IE to CDR field
chfCdr := record.ChargingFunctionRecord

Expand Down
1 change: 1 addition & 0 deletions internal/sbi/processor/converged_charging.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ func (p *Processor) ChargingDataRelease(
if err != nil {
problemDetails := &models.ProblemDetails{
Status: http.StatusBadRequest,
Cause: err.Error(),
}
return problemDetails
}
Expand Down

0 comments on commit f4bfcea

Please sign in to comment.