Handle ledger parse errors

This commit is contained in:
nick 2008-12-09 21:00:46 +00:00
parent ae9636e55c
commit e68a72b072

View File

@ -42,7 +42,10 @@ module Main (
module UICommand,
)
where
import Control.Monad.Error
import qualified Data.Map as Map (lookup)
import System.IO
import Ledger
import Utils
import Options
@ -74,5 +77,4 @@ parseLedgerAndDo :: [Opt] -> [String] -> ([Opt] -> [String] -> Ledger -> IO ())
parseLedgerAndDo opts args cmd = do
refdate <- today
let runcmd = cmd opts args . prepareLedger opts args refdate
ledgerFilePathFromOpts opts >>= parseLedgerFile >>= either printParseError runcmd
ledgerFilePathFromOpts opts >>= runErrorT . parseLedgerFile >>= either (hPutStrLn stderr) runcmd