mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-20 02:37:12 +03:00
fix: csv: report correct CSV line number in errors
Some errors in CSV conversion, such as a failing balance assertion, were always being reported as line 2. Reported by Lawrence Wu.
This commit is contained in:
parent
8274da81fc
commit
5485990cac
@ -740,7 +740,7 @@ readJournalFromCsv mrulesfile csvfile csvdata =
|
||||
-- mfieldnames = lastMay headerlines
|
||||
|
||||
let
|
||||
-- convert CSV records to transactions
|
||||
-- convert CSV records to transactions, saving the CSV line numbers for error positions
|
||||
txns = dbg7 "csv txns" $ snd $ mapAccumL
|
||||
(\pos r ->
|
||||
let
|
||||
@ -748,7 +748,7 @@ readJournalFromCsv mrulesfile csvfile csvdata =
|
||||
line' = (mkPos . (+1) . unPos) line
|
||||
pos' = SourcePos name line' col
|
||||
in
|
||||
(pos, transactionFromCsvRecord pos' rules r)
|
||||
(pos', transactionFromCsvRecord pos rules r)
|
||||
)
|
||||
(initialPos parsecfilename) records
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user