From d31b84c777b6ba7158be8947fc2236b2a15e29bb Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 5 Jul 2011 14:58:33 -0400 Subject: better display of thrown errors --- Command.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Command.hs') diff --git a/Command.hs b/Command.hs index d36f675d2..c666ddbd2 100644 --- a/Command.hs +++ b/Command.hs @@ -96,10 +96,15 @@ prepCommand Command { cmdseek = seek } params = do doCommand :: CommandStart -> CommandCleanup doCommand = start where - start = stage $ maybe (return True) perform - perform = stage $ maybe (showEndFail >> return False) cleanup + start = stage $ maybe success perform + perform = stage $ maybe failure cleanup cleanup = stage $ \r -> showEndResult r >> return r stage a b = b >>= a + success = return True + failure = do + showProgress + showEndFail + return False notAnnexed :: FilePath -> Annex (Maybe a) -> Annex (Maybe a) notAnnexed file a = maybe a (const $ return Nothing) =<< Backend.lookupFile file -- cgit v1.2.3