catch does not exist error when adding a watch

This could be thrown due to eg, the directory being moved or deleted, so
the error should not be propigated.
This commit is contained in:
Joey Hess 2013-07-17 15:32:24 -04:00
parent 40f310fe0b
commit 8b644e74fa

View file

@ -144,13 +144,15 @@ watchDir i dir ignored hooks
_ -> noop
filetype t f = catchBoolIO $ t <$> getSymbolicLinkStatus (indir f)
-- Inotify fails when there are too many watches with a
-- disk full error.
failedaddwatch e
-- Inotify fails when there are too many watches with a
-- disk full error.
| isFullError e =
case errHook hooks of
Nothing -> throw e
Just hook -> tooManyWatches hook dir
-- The directory could have been deleted.
| isDoesNotExistError e = return ()
| otherwise = throw e
tooManyWatches :: (String -> Maybe FileStatus -> IO ()) -> FilePath -> IO ()