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 |   --     mfieldnames = lastMay headerlines | ||||||
| 
 | 
 | ||||||
|   let |   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 |     txns = dbg7 "csv txns" $ snd $ mapAccumL | ||||||
|                    (\pos r -> |                    (\pos r -> | ||||||
|                       let |                       let | ||||||
| @ -748,7 +748,7 @@ readJournalFromCsv mrulesfile csvfile csvdata = | |||||||
|                         line' = (mkPos . (+1) . unPos) line |                         line' = (mkPos . (+1) . unPos) line | ||||||
|                         pos' = SourcePos name line' col |                         pos' = SourcePos name line' col | ||||||
|                       in |                       in | ||||||
|                         (pos, transactionFromCsvRecord pos' rules r) |                         (pos', transactionFromCsvRecord pos rules r) | ||||||
|                    ) |                    ) | ||||||
|                    (initialPos parsecfilename) records |                    (initialPos parsecfilename) records | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user