summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-02-03 16:47:24 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-02-03 16:47:24 -0400
commit146c36ca545a297f1e44e3cf2c91f3c0e17c909f (patch)
tree56d6fb274427bb793155182aed7e92e2e00895ba /Annex
parent05f89123e08075cfbd136f37c60423c1ad38d1fe (diff)
IO exception rework
ghc 7.4 comaplains about use of System.IO.Error to catch exceptions. Ok, use Control.Exception, with variants specialized to only catch IO exceptions.
Diffstat (limited to 'Annex')
-rw-r--r--Annex/Content.hs3
-rw-r--r--Annex/Journal.hs2
-rw-r--r--Annex/Ssh.hs4
3 files changed, 4 insertions, 5 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs
index dcfd43866..d10370bc9 100644
--- a/Annex/Content.hs
+++ b/Annex/Content.hs
@@ -25,7 +25,6 @@ module Annex.Content (
preseedTmp,
) where
-import System.IO.Error (try)
import Control.Exception (bracket_)
import System.Posix.Types
@@ -79,7 +78,7 @@ lockContent key a = do
where
lock Nothing = return Nothing
lock (Just l) = do
- v <- try $ setLock l (WriteLock, AbsoluteSeek, 0, 0)
+ v <- tryIO $ setLock l (WriteLock, AbsoluteSeek, 0, 0)
case v of
Left _ -> error "content is locked"
Right _ -> return $ Just l
diff --git a/Annex/Journal.hs b/Annex/Journal.hs
index 9c5be89b1..34c4d98c8 100644
--- a/Annex/Journal.hs
+++ b/Annex/Journal.hs
@@ -91,4 +91,4 @@ lockJournal a = do
{- Runs an action, catching failure and running something to fix it up, and
- retrying if necessary. -}
doRedo :: IO a -> IO b -> IO a
-doRedo a b = catch a $ const $ b >> a
+doRedo a b = catchIO a $ const $ b >> a
diff --git a/Annex/Ssh.hs b/Annex/Ssh.hs
index 14ea74e53..d6f36e868 100644
--- a/Annex/Ssh.hs
+++ b/Annex/Ssh.hs
@@ -11,7 +11,6 @@ module Annex.Ssh (
) where
import qualified Data.Map as M
-import System.IO.Error (try)
import Common.Annex
import Annex.LockPool
@@ -72,7 +71,8 @@ sshCleanup = do
let lockfile = socket2lock socketfile
unlockFile lockfile
fd <- liftIO $ openFd lockfile ReadWrite (Just stdFileMode) defaultFileFlags
- v <- liftIO $ try $ setLock fd (WriteLock, AbsoluteSeek, 0, 0)
+ v <- liftIO $ tryIO $
+ setLock fd (WriteLock, AbsoluteSeek, 0, 0)
case v of
Left _ -> return ()
Right _ -> stopssh socketfile