diff options
author | 2011-11-10 20:24:24 -0400 | |
---|---|---|
committer | 2011-11-10 20:57:28 -0400 | |
commit | 49d2177d51b95b4a01c05ee07e166e93751b4c51 (patch) | |
tree | b818865e5a924dc90bf0a79608351b1aeffe458a /Annex/Branch.hs | |
parent | a71c03bc5162916853ff520d5c7c89e849c6a047 (diff) |
factored out some useful error catching methods
Diffstat (limited to 'Annex/Branch.hs')
-rw-r--r-- | Annex/Branch.hs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Annex/Branch.hs b/Annex/Branch.hs index 189289ad3..6c28a0c84 100644 --- a/Annex/Branch.hs +++ b/Annex/Branch.hs @@ -295,10 +295,8 @@ setJournalFile file content = do {- Gets any journalled content for a file in the branch. -} getJournalFile :: FilePath -> Annex (Maybe String) -getJournalFile file = do - g <- gitRepo - liftIO $ catch (liftM Just . readFileStrict $ journalFile g file) - (const $ return Nothing) +getJournalFile file = inRepo $ \g -> catchMaybeIO $ + readFileStrict $ journalFile g file {- List of files that have updated content in the journal. -} getJournalledFiles :: Annex [FilePath] @@ -308,8 +306,8 @@ getJournalledFiles = map fileJournal <$> getJournalFiles getJournalFiles :: Annex [FilePath] getJournalFiles = do g <- gitRepo - fs <- liftIO $ catch (getDirectoryContents $ gitAnnexJournalDir g) - (const $ return []) + fs <- liftIO $ + catchDefaultIO (getDirectoryContents $ gitAnnexJournalDir g) [] return $ filter (`notElem` [".", ".."]) fs {- Stages the specified journalfiles. -} |