Handle ledger parse errors
This commit is contained in:
parent
ae9636e55c
commit
e68a72b072
@ -42,7 +42,10 @@ module Main (
|
|||||||
module UICommand,
|
module UICommand,
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
import Control.Monad.Error
|
||||||
import qualified Data.Map as Map (lookup)
|
import qualified Data.Map as Map (lookup)
|
||||||
|
import System.IO
|
||||||
|
|
||||||
import Ledger
|
import Ledger
|
||||||
import Utils
|
import Utils
|
||||||
import Options
|
import Options
|
||||||
@ -74,5 +77,4 @@ parseLedgerAndDo :: [Opt] -> [String] -> ([Opt] -> [String] -> Ledger -> IO ())
|
|||||||
parseLedgerAndDo opts args cmd = do
|
parseLedgerAndDo opts args cmd = do
|
||||||
refdate <- today
|
refdate <- today
|
||||||
let runcmd = cmd opts args . prepareLedger opts args refdate
|
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