mirror of
https://github.com/simonmichael/hledger.git
synced 2025-01-07 11:19:32 +03:00
Handle ledger parse errors
This commit is contained in:
parent
ae9636e55c
commit
e68a72b072
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user