From 5f87e7cd5d04cef91f7674f57cedc3ce3c0f07e6 Mon Sep 17 00:00:00 2001 From: Alex Chen Date: Wed, 6 Jun 2018 00:31:37 -0600 Subject: [PATCH] lib: enable the custom parse errors --- hledger-lib/Hledger/Read/Common.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hledger-lib/Hledger/Read/Common.hs b/hledger-lib/Hledger/Read/Common.hs index 0a38a7909..6e10afba4 100644 --- a/hledger-lib/Hledger/Read/Common.hs +++ b/hledger-lib/Hledger/Read/Common.hs @@ -119,6 +119,7 @@ import Text.Megaparsec.Char.Lexer (decimal) import Hledger.Data import Hledger.Utils +import Hledger.Utils.ParseErrors import qualified Hledger.Query as Q (Query(Any)) -- | A hledger journal reader is a triple of storage format name, a @@ -229,7 +230,7 @@ parseAndFinaliseJournal parser iopts f txt = do case journalFinalise t f txt (not $ ignore_assertions_ iopts) pj' of Right j -> return j Left e -> throwError e - Left e -> throwError $ parseErrorPretty e + Left e -> throwError $ customParseErrorPretty txt e parseAndFinaliseJournal' :: JournalParser Identity ParsedJournal -> InputOpts -> FilePath -> Text -> ExceptT String IO Journal