diff options
author | Joey Hess <joey@kitenet.net> | 2012-09-24 13:16:50 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-09-24 13:18:16 -0400 |
commit | 3887432c54e1da6d66d364bb7f153a3c6a1cace8 (patch) | |
tree | 9941b1cd365ffadd13bdb84d33e4b07e4bb3f1e4 /Annex/Exception.hs | |
parent | 364b40e5fcad5e6221df75b49953c838407a4546 (diff) |
fixes for transfer resume
Fix resuming of downloads, which do not have a transfer info file to read.
When checking upload progress, use the MVar, rather than re-reading
the info file.
Catch exceptions in the transfer action. Required a tryAnnex.
Diffstat (limited to 'Annex/Exception.hs')
-rw-r--r-- | Annex/Exception.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Annex/Exception.hs b/Annex/Exception.hs index cb36d1bdb..4d21297b1 100644 --- a/Annex/Exception.hs +++ b/Annex/Exception.hs @@ -8,12 +8,13 @@ module Annex.Exception ( bracketIO, handle, + tryAnnex, throw, ) where -import Control.Exception.Lifted (handle) +import Control.Exception.Lifted (handle, try) import Control.Monad.Trans.Control (liftBaseOp) -import Control.Exception hiding (handle, throw) +import Control.Exception hiding (handle, try, throw) import Common.Annex @@ -22,6 +23,10 @@ bracketIO :: IO c -> (c -> IO b) -> Annex a -> Annex a bracketIO setup cleanup go = liftBaseOp (Control.Exception.bracket setup cleanup) (const go) +{- try in the Annex monad -} +tryAnnex :: Annex a -> Annex (Either SomeException a) +tryAnnex = try + {- Throws an exception in the Annex monad. -} throw :: Control.Exception.Exception e => e -> Annex a throw = liftIO . throwIO |