summaryrefslogtreecommitdiff
path: root/Annex/Exception.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Annex/Exception.hs')
-rw-r--r--Annex/Exception.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/Annex/Exception.hs b/Annex/Exception.hs
index 99466a851..aaa6811a5 100644
--- a/Annex/Exception.hs
+++ b/Annex/Exception.hs
@@ -13,6 +13,7 @@
module Annex.Exception (
bracketIO,
tryAnnex,
+ tryAnnexIO,
throwAnnex,
catchAnnex,
) where
@@ -24,12 +25,16 @@ import Common.Annex
{- Runs an Annex action, with setup and cleanup both in the IO monad. -}
bracketIO :: IO v -> (v -> IO b) -> (v -> Annex a) -> Annex a
-bracketIO setup cleanup go = M.bracket (liftIO setup) (liftIO . cleanup) go
+bracketIO setup cleanup = M.bracket (liftIO setup) (liftIO . cleanup)
{- try in the Annex monad -}
tryAnnex :: Annex a -> Annex (Either SomeException a)
tryAnnex = M.try
+{- try in the Annex monad, but only catching IO exceptions -}
+tryAnnexIO :: Annex a -> Annex (Either IOException a)
+tryAnnexIO = M.try
+
{- throw in the Annex monad -}
throwAnnex :: Exception e => e -> Annex a
throwAnnex = M.throw