diff options
author | Joey Hess <joey@kitenet.net> | 2011-07-05 14:58:33 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-07-05 14:58:33 -0400 |
commit | d31b84c777b6ba7158be8947fc2236b2a15e29bb (patch) | |
tree | 737c18d77f4f627efc7b0db5efa8d579e6026c72 /Command.hs | |
parent | 82eb082ab9a33713ed1ec3674be2b95f9b81d861 (diff) |
better display of thrown errors
Diffstat (limited to 'Command.hs')
-rw-r--r-- | Command.hs | 9 |
1 files changed, 7 insertions, 2 deletions
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 |