diff --git a/app/Main.hs b/app/Main.hs index fe901e1..2cdd5f0 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -1,8 +1,8 @@ -{-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} module Main (main) where +import qualified Data.Text.IO as TI import Internal.Config import Internal.Database.Ops import Internal.Insert @@ -157,12 +157,16 @@ runDumpAccountKeys c = do runSync :: MonadUnliftIO m => FilePath -> m () runSync c = do config <- readConfig c - migrate_ (sqlConfig config) $ do + handle err $ migrate_ (sqlConfig config) $ do s <- getDBState config flip runReaderT (s $ takeDirectory c) $ do es1 <- insertBudget $ budget config es2 <- insertStatements config let es = es1 ++ es2 unless (null es) $ throwIO $ InsertException es + where + err (InsertException es) = do + liftIO $ mapM_ TI.putStrLn $ concatMap showError es + exitFailure -- showBalances