diff --git a/transactions/aibTransaction.go b/transactions/aibTransaction.go index 142c195..387deeb 100644 --- a/transactions/aibTransaction.go +++ b/transactions/aibTransaction.go @@ -29,7 +29,7 @@ func NewAIBTransaction(rawData string) *aibTransaction { transactionDate, err := time.Parse("02/01/06", data[1]) if err != nil { - log.Fatal("Could not parse date: ", err) + log.Fatal("Could not parse date: ", err, "\nRaw data: ", rawData) } t.completedDate = transactionDate @@ -39,7 +39,7 @@ func NewAIBTransaction(rawData string) *aibTransaction { t.amount, err = t.parseAmount(data[3], data[4]) if err != nil { - log.Fatal("Could not parse amount: ", err) + log.Fatal("Could not parse amount: ", err, "\nRaw data: ", rawData) } t.balance = data[5] @@ -80,7 +80,7 @@ func (t aibTransaction) parseAmount(debitAmount string, creditAmount string) (fl amount, err := strconv.ParseFloat(debitAmount, 32) if err != nil { - log.Fatal("Could not parse amount: ", err) + return amount, fmt.Errorf("Could not parse amount: %w", err) } return amount, nil @@ -90,7 +90,7 @@ func (t aibTransaction) parseAmount(debitAmount string, creditAmount string) (fl amount, err := strconv.ParseFloat(creditAmount, 32) if err != nil { - log.Fatal("Could not parse amount: ", err) + return amount, fmt.Errorf("Could not parse amount: %w") } if amount != 0 { diff --git a/transactions/revolutTransaction.go b/transactions/revolutTransaction.go index ddfd26c..18dec03 100644 --- a/transactions/revolutTransaction.go +++ b/transactions/revolutTransaction.go @@ -34,7 +34,7 @@ func NewRevolutTransaction(rawData string) *revolutTransaction { completedDate, err := time.Parse("2 Jan 2006", data[0]) if err != nil { - log.Fatal("Could not parse date: ", err) + log.Fatal("Could not parse date: ", err, "\nRaw data: ", rawData) } t.completedDate = completedDate @@ -46,7 +46,7 @@ func NewRevolutTransaction(rawData string) *revolutTransaction { if paidOut != "" { t.amount, err = strconv.ParseFloat(paidOut, 64) if err != nil { - log.Fatal("Could not parse amount: ", err, "\nRaw data: ", rawData) + log.Fatal("Could not parse date: ", err, "\nRaw data: ", rawData) } } else { t.amount, err = strconv.ParseFloat(paidIn, 32)