better result summary

This commit is contained in:
Joey Hess 2010-10-11 18:39:09 -04:00
parent 8f99409518
commit 530f16b980

View file

@ -13,21 +13,21 @@ main = do
state <- startAnnex state <- startAnnex
tryRun 0 $ map (\f -> dispatch state mode f) files tryRun 0 0 $ map (\f -> dispatch state mode f) files
{- Tries to run a series of actions, not stopping if some error out, {- Tries to run a series of actions, not stopping if some error out,
- and propigating an overall error status at the end. -} - and propigating an overall error status at the end. -}
tryRun errflag [] = do tryRun errnum oknum [] = do
if (errflag > 0) if (errnum > 0)
then error "unsuccessful" then error $ (show errnum) ++ " failed ; " ++ show (oknum) ++ " succeeded"
else return () else return ()
tryRun errflag (a:as) = do tryRun errnum oknum (a:as) = do
result <- try (a)::IO (Either SomeException ()) result <- try (a)::IO (Either SomeException ())
case (result) of case (result) of
Left err -> do Left err -> do
showErr err showErr err
tryRun 1 as tryRun (errnum + 1) oknum as
Right _ -> tryRun errflag as Right _ -> tryRun errnum (oknum + 1) as
{- Exception pretty-printing. -} {- Exception pretty-printing. -}
showErr :: SomeException -> IO () showErr :: SomeException -> IO ()