aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-07-05 14:58:33 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-07-05 14:58:33 -0400
commitd31b84c777b6ba7158be8947fc2236b2a15e29bb (patch)
tree737c18d77f4f627efc7b0db5efa8d579e6026c72
parent82eb082ab9a33713ed1ec3674be2b95f9b81d861 (diff)
better display of thrown errors
-rw-r--r--CmdLine.hs4
-rw-r--r--Command.hs9
-rw-r--r--Command/Map.hs1
-rw-r--r--Messages.hs6
4 files changed, 15 insertions, 5 deletions
diff --git a/CmdLine.hs b/CmdLine.hs
index 85423e5e8..46b980fbc 100644
--- a/CmdLine.hs
+++ b/CmdLine.hs
@@ -87,7 +87,9 @@ tryRun' state errnum (a:as) = do
a
case result of
Left err -> do
- Annex.eval state $ showErr err
+ Annex.eval state $ do
+ showEndFail
+ showErr err
tryRun' state (errnum + 1) as
Right (True,state') -> tryRun' state' errnum as
Right (False,state') -> tryRun' state' (errnum + 1) as
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
diff --git a/Command/Map.hs b/Command/Map.hs
index 7bb435ff8..940db54c8 100644
--- a/Command/Map.hs
+++ b/Command/Map.hs
@@ -175,6 +175,7 @@ scan r = do
showEndOk
return r'
Nothing -> do
+ showProgress
showEndFail
return r
diff --git a/Messages.hs b/Messages.hs
index c44e44eea..038e4c0bc 100644
--- a/Messages.hs
+++ b/Messages.hs
@@ -43,14 +43,16 @@ showEndOk :: Annex ()
showEndOk = verbose $ liftIO $ putStrLn "ok"
showEndFail :: Annex ()
-showEndFail = verbose $ liftIO $ putStrLn "\nfailed"
+showEndFail = verbose $ liftIO $ putStrLn "failed"
showEndResult :: Bool -> Annex ()
showEndResult True = showEndOk
showEndResult False = showEndFail
showErr :: (Show a) => a -> Annex ()
-showErr e = warning $ "git-annex: " ++ show e
+showErr e = do
+ liftIO $ hFlush stdout
+ liftIO $ hPutStrLn stderr $ "git-annex: " ++ show e
warning :: String -> Annex ()
warning w = do