From a5dcd0e4bd802dda17cf2d43fbd12bb27ec21061 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 22 Mar 2014 14:17:57 -0400 Subject: [PATCH] fix failure notification --- Annex/Transfer.hs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Annex/Transfer.hs b/Annex/Transfer.hs index dac32e7529..0d5744d4ee 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