;csv: mention doc url in too many amounts error (#1226)

This commit is contained in:
Simon Michael 2020-04-16 08:36:04 -07:00
parent a016a43785
commit 3693fd4eb6

View File

@ -898,13 +898,16 @@ getAmount rules record currency p1IsVirtual n =
[] -> Nothing [] -> Nothing
[(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' $ fs -> error' $ unlines $ [
"more than one non-zero amount for this record, or multiple zeros - please ensure just one\n" "more than one non-zero amount for this record, or multiple zeros"
++ " " ++ showRecord record ++ "\n" ,"- please ensure just one. (https://hledger.org/csv.html#amount)"
++ unlines [" rule: " ++ f ++ " " ++ ," " ++ showRecord record
fromMaybe "" (hledgerField rules record f) ++ ]
" amount parsed: " ++ showMixedAmount a -- XXX not sure this is showing all the right info ++ [" rule: " ++ f ++ " " ++
| (f,a) <- fs] fromMaybe "" (hledgerField rules record f) ++
" amount parsed: " ++ showMixedAmount a -- XXX not sure this is showing all the right info
| (f,a) <- fs]
where where
-- | Given a non-empty amount string to parse, along with a possibly -- | Given a non-empty amount string to parse, along with a possibly
-- non-empty currency symbol to prepend, parse as a hledger amount (as -- non-empty currency symbol to prepend, parse as a hledger amount (as