From 3693fd4eb64f34f4155a7127915915ed3912a3ab Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 16 Apr 2020 08:36:04 -0700 Subject: [PATCH] ;csv: mention doc url in too many amounts error (#1226) --- hledger-lib/Hledger/Read/CsvReader.hs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/hledger-lib/Hledger/Read/CsvReader.hs b/hledger-lib/Hledger/Read/CsvReader.hs index 56550c01c..9e2df62e4 100644 --- a/hledger-lib/Hledger/Read/CsvReader.hs +++ b/hledger-lib/Hledger/Read/CsvReader.hs @@ -898,13 +898,16 @@ getAmount rules record currency p1IsVirtual n = [] -> Nothing [(f,a)] | "-out" `isSuffixOf` f -> Just (-a) -- for -out fields, flip the sign [(_,a)] -> Just a - fs -> error' $ - "more than one non-zero amount for this record, or multiple zeros - please ensure just one\n" - ++ " " ++ showRecord record ++ "\n" - ++ unlines [" rule: " ++ f ++ " " ++ - fromMaybe "" (hledgerField rules record f) ++ - " amount parsed: " ++ showMixedAmount a -- XXX not sure this is showing all the right info - | (f,a) <- fs] + fs -> error' $ unlines $ [ + "more than one non-zero amount for this record, or multiple zeros" + ,"- please ensure just one. (https://hledger.org/csv.html#amount)" + ," " ++ showRecord record + ] + ++ [" rule: " ++ f ++ " " ++ + fromMaybe "" (hledgerField rules record f) ++ + " amount parsed: " ++ showMixedAmount a -- XXX not sure this is showing all the right info + | (f,a) <- fs] + where -- | Given a non-empty amount string to parse, along with a possibly -- non-empty currency symbol to prepend, parse as a hledger amount (as