diff options
author | Joey Hess <joey@kitenet.net> | 2010-10-19 01:46:20 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-10-19 01:46:20 -0400 |
commit | 2caf711827470976f935bb06bb3b6b87e1776299 (patch) | |
tree | e2e3abec102b1c6f23234ef891b196f3b7f512e4 /Commands.hs | |
parent | 470e0a2fbd1f554df677127212643d534c2f7857 (diff) |
stop trapping all exceptions
Need to allow exceptions to be thrown for SIGPIPE propigation.
Converted places that used error unncessarily to not.
Diffstat (limited to 'Commands.hs')
-rw-r--r-- | Commands.hs | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/Commands.hs b/Commands.hs index fab72160a..115c3b3ed 100644 --- a/Commands.hs +++ b/Commands.hs @@ -101,21 +101,19 @@ parseCmd argv state = do - the annex directory and setting up the symlink pointing to its content. -} addCmd :: FilePath -> Annex () addCmd file = inBackend file $ do - liftIO $ checkLegal file - showStart "add" file - g <- Annex.gitRepo - stored <- Backend.storeFileKey file - case (stored) of - Nothing -> showEndFail "no backend could store" file - Just (key, backend) -> do - logStatus key ValuePresent - setup g key + s <- liftIO $ getSymbolicLinkStatus file + if ((isSymbolicLink s) || (not $ isRegularFile s)) + then return () + else do + showStart "add" file + g <- Annex.gitRepo + stored <- Backend.storeFileKey file + case (stored) of + Nothing -> showEndFail "no backend could store" file + Just (key, backend) -> do + logStatus key ValuePresent + setup g key where - checkLegal file = do - s <- getSymbolicLinkStatus file - if ((isSymbolicLink s) || (not $ isRegularFile s)) - then error $ "not a regular file: " ++ file - else return () setup g key = do let dest = annexLocation g key liftIO $ createDirectoryIfMissing True (parentDir dest) |