lib/storage: prevent from clobbering nin-nil lastError in Storage.add

This commit is contained in:
Aliaksandr Valialkin 2020-02-16 15:51:11 +02:00
parent 7b1c7051a3
commit 32e153e834

View File

@ -970,8 +970,8 @@ func (s *Storage) add(rows []rawRow, mrs []MetricRow, precisionBits uint8) ([]ra
if err := s.tb.AddRows(rows); err != nil {
lastError = fmt.Errorf("cannot add rows to table: %s", err)
}
if err := s.updatePerDateData(rows, lastError); err != nil {
lastError = err
if err := s.updatePerDateData(rows, lastError); err != nil lastError == nil {
lastError = fmt.Errorf("cannot update per-date data: %s", err)
}
if lastError != nil {
return rows, fmt.Errorf("error occurred during rows addition: %s", lastError)