;csv: tweak the too-many-amounts error more

This commit is contained in:
Simon Michael 2020-04-16 12:59:19 -07:00
parent dd3db5a4e2
commit b149c0ba0c

View File

@ -899,13 +899,14 @@ getAmount rules record currency p1IsVirtual n =
[(f,a)] | "-out" `isSuffixOf` f -> Just (-a) -- for -out fields, flip the sign [(f,a)] | "-out" `isSuffixOf` f -> Just (-a) -- for -out fields, flip the sign
[(_,a)] -> Just a [(_,a)] -> Just a
fs -> error' $ unlines $ [ fs -> error' $ unlines $ [
"more than one non-zero amount for this record, or multiple zeros" "multiple non-zero amounts or multiple zero amounts assigned,"
,"- please ensure just one. (https://hledger.org/csv.html#amount)" ,"please ensure just one. (https://hledger.org/csv.html#amount)"
," " ++ showRecord record ," " ++ showRecord record
," for posting: " ++ show n
] ]
++ [" rule: " ++ f ++ " " ++ ++ [" assignment: " ++ f ++ " " ++
fromMaybe "" (hledgerField rules record f) ++ fromMaybe "" (hledgerField rules record f) ++
" amount parsed: " ++ showMixedAmount a -- XXX not sure this is showing all the right info "\t=> value: " ++ showMixedAmount a -- XXX not sure this is showing all the right info
| (f,a) <- fs] | (f,a) <- fs]
where where