mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-21 23:28:44 +05:00
Revise err handling for CSV storage constructor
NewFileCSVStorage() now returns an error besides the storage struct itself, which is logged and returned instead of calling log.Fatal() which was causing the engine to crash. Fixed compilation errors by creating the CSVStorage separately and passing it as an argument to the TpReader constructor.
This commit is contained in:
@@ -398,7 +398,11 @@ func StopStartEngine(cfgPath string, waitEngine int) (*exec.Cmd, error) {
|
||||
|
||||
func LoadTariffPlanFromFolder(tpPath, timezone string, dm *DataManager, disable_reverse bool,
|
||||
cacheConns, schedConns []string) error {
|
||||
loader, err := NewTpReader(dm.dataDB, NewFileCSVStorage(utils.CSVSep, tpPath), "",
|
||||
csvStorage, err := NewFileCSVStorage(utils.CSVSep, tpPath)
|
||||
if err != nil {
|
||||
return utils.NewErrServerError(err)
|
||||
}
|
||||
loader, err := NewTpReader(dm.dataDB, csvStorage, "",
|
||||
timezone, cacheConns, schedConns, false)
|
||||
if err != nil {
|
||||
return utils.NewErrServerError(err)
|
||||
|
||||
Reference in New Issue
Block a user