summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-03-22 14:17:57 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-03-22 14:26:36 -0400
commit6af20ba3f858165743a8bad35388be12c498cf5f (patch)
tree4babb77682b88c05713b15dccd316095b2a7ed35 /Annex
parent35419994e9418444dc82e5c90c579203cc4c3616 (diff)
fix failure notification
Diffstat (limited to 'Annex')
-rw-r--r--Annex/Transfer.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/Annex/Transfer.hs b/Annex/Transfer.hs
index dac32e752..0d5744d4e 100644
--- a/Annex/Transfer.hs
+++ b/Annex/Transfer.hs
@@ -150,7 +150,9 @@ notifyTransfer direction (Just f) a = do
let action = if direction == Upload then "uploading" else "downloading"
let basedesc = action ++ " " ++ f
let startdesc = "started " ++ basedesc
- let enddesc = "finished " ++ basedesc
+ let enddesc ok = if ok
+ then "finished " ++ basedesc
+ else basedesc ++ " failed"
if (notifyStart wanted || notifyFinish wanted)
then do
client <- liftIO DBus.Client.connectSession
@@ -166,12 +168,12 @@ notifyTransfer direction (Just f) a = do
startnotification <- liftIO $ if notifyStart wanted
then Just <$> Notify.notify client (mknote startdesc)
else pure Nothing
- r <- a NotifyWitness
+ ok <- a NotifyWitness
when (notifyFinish wanted) $ liftIO $ void $ maybe
- (Notify.notify client $ mknote enddesc)
- (\n -> Notify.replace client n $ mknote enddesc)
+ (Notify.notify client $ mknote $ enddesc ok)
+ (\n -> Notify.replace client n $ mknote $ enddesc ok)
startnotification
- return r
+ return ok
else a NotifyWitness
#else
a NotifyWitness