From 723c96834c86da1026449e81be27d4f3dfd487c9 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 9 Mar 2010 18:34:20 +0000 Subject: [PATCH] tweak txn balancing error message --- hledger-lib/Ledger/Transaction.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hledger-lib/Ledger/Transaction.hs b/hledger-lib/Ledger/Transaction.hs index 616e33d92..52c32e1c2 100644 --- a/hledger-lib/Ledger/Transaction.hs +++ b/hledger-lib/Ledger/Transaction.hs @@ -110,7 +110,7 @@ isTransactionBalanced (Transaction {tpostings=ps}) = -- return an error message instead. balanceTransaction :: Transaction -> Either String Transaction balanceTransaction t@Transaction{tpostings=ps} - | length missingamounts' > 1 = Left $ printerr "could not balance this transaction, too many missing amounts" + | length missingamounts' > 1 = Left $ printerr "could not balance this transaction (too many missing amounts)" | not $ isTransactionBalanced t' = Left $ printerr nonzerobalanceerror | otherwise = Right t' where @@ -123,7 +123,7 @@ balanceTransaction t@Transaction{tpostings=ps} balance p | isReal p && not (hasAmount p) = p{pamount = costOfMixedAmount (-otherstotal)} | otherwise = p where otherstotal = sum $ map pamount withamounts - printerr s = printf "%s:\n%s" s (showTransactionUnelided t) + printerr s = unlines [s, showTransactionUnelided t] nonzerobalanceerror = "could not balance this transaction, amounts do not add up to zero"