From c9937db10e8644eb067249d0899d2c9c8bfb8595 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Fri, 19 Feb 2016 22:46:59 -0800 Subject: [PATCH] lib: show txn's file position in assertion errors --- hledger-lib/Hledger/Data/Journal.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hledger-lib/Hledger/Data/Journal.hs b/hledger-lib/Hledger/Data/Journal.hs index eb7a62664..babf2667d 100644 --- a/hledger-lib/Hledger/Data/Journal.hs +++ b/hledger-lib/Hledger/Data/Journal.hs @@ -494,7 +494,11 @@ checkBalanceAssertion (errs,startbal) ps (showMixedAmount finalsinglebal) (diffplus ++ showMixedAmount diff) (showPostingLine p) - (maybe "" (("in transaction:\n"++).show) $ ptransaction p) + (case ptransaction p of + Nothing -> "" + Just t -> printf "in transaction at %s line %d:\n%s" f l (show t) + where GenericSourcePos f l _ = tsourcepos t + ) -- Given a sequence of postings to a single account, split it into -- sub-sequences consisting of ordinary postings followed by a single