;repl: dont stop on exceptions

This commit is contained in:
Dmitry Astapov 2025-02-28 12:18:20 +00:00 committed by Simon Michael
parent 2ba12d6ec5
commit 2f348f787b

View File

@ -25,6 +25,7 @@ import System.Console.CmdArgs.Explicit as C ( Mode )
import Hledger import Hledger
import Hledger.Cli.CliOptions import Hledger.Cli.CliOptions
import Control.Exception
import Control.Concurrent.MVar import Control.Concurrent.MVar
import Control.Monad (forM_) import Control.Monad (forM_)
import Control.Monad.IO.Class (liftIO) import Control.Monad.IO.Class (liftIO)
@ -145,8 +146,8 @@ runREPL defaultJrnl findBuiltinCommand = do
Just "quit" -> return () Just "quit" -> return ()
Just "exit" -> return () Just "exit" -> return ()
Just input -> do Just input -> do
liftIO $ runCommand defaultJrnl findBuiltinCommand $ parseCommand input liftIO $ (runCommand defaultJrnl findBuiltinCommand $ parseCommand input)
loop `catch` (\(e::ErrorCall) -> putStr $ show e)
-- | Cache of all journals that have been read by commands given to "run", -- | Cache of all journals that have been read by commands given to "run",
-- keyed by the fully-expanded filename. -- keyed by the fully-expanded filename.