diff options
Diffstat (limited to 'Annex')
-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 |