From 10b92599f9b02e21d8d2931be78ada41386957b3 Mon Sep 17 00:00:00 2001 From: DanB Date: Thu, 18 Apr 2013 18:06:55 +0200 Subject: [PATCH] Properly populating error in mediated file --- mediator/mediator.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/mediator/mediator.go b/mediator/mediator.go index 451b0c6a7..e808e314b 100644 --- a/mediator/mediator.go +++ b/mediator/mediator.go @@ -163,18 +163,12 @@ func (m *Mediator) parseCSV(cdrfn string) (err error) { for runIdx, idxVal := range m.subjectIndexs { // Query costs for every run index given by subject if idxVal == -1 { // -1 as subject means use database to get previous set price cc, err = m.getCostsFromDB(record, runIdx) - if err != nil || cc == nil { // Fallback on rater if no db record found - rater.Logger.Err(fmt.Sprintf(" Error extracting price from database for uuid: <%s>, err: <%s>, cost: %v", record[m.uuidIndexs[runIdx]], err.Error(), cc)) - //cc, err = m.getCostsFromRater(record, runIdx) - continue - } } else { cc, err = m.getCostsFromRater(record, runIdx) - } cost := "-1" - if err != nil { - rater.Logger.Err(fmt.Sprintf("Could not get the cost for mediator record with uuid:%s and subject:%s - %s", record[m.uuidIndexs[runIdx]], record[m.subjectIndexs[runIdx]], err.Error())) + if err != nil || cc == nil { + rater.Logger.Err(fmt.Sprintf(" Could not calculate price for uuid: <%s>, err: <%s>, cost: <%v>", record[m.uuidIndexs[runIdx]], err.Error(), cc)) } else { cost = strconv.FormatFloat(cc.ConnectFee+cc.Cost, 'f', -1, 64) rater.Logger.Debug(fmt.Sprintf("Calculated for uuid:%s, cost: %v", record[m.uuidIndexs[runIdx]], cost))