parent
fd7807a66e
commit
793aad7b6c
@ -371,8 +371,7 @@ searchPath paths needle = go paths
|
|||||||
where
|
where
|
||||||
go [] = pure Nothing
|
go [] = pure Nothing
|
||||||
go (x : xs) =
|
go (x : xs) =
|
||||||
hideErrorDefM PermissionDenied (go xs)
|
hideErrorDefM [InappropriateType, PermissionDenied, NoSuchThing] (go xs)
|
||||||
$ hideErrorDefM NoSuchThing (go xs)
|
|
||||||
$ do
|
$ do
|
||||||
dirStream <- openDirStream (toFilePath x)
|
dirStream <- openDirStream (toFilePath x)
|
||||||
S.findM (\(_, p) -> isMatch x p) (dirContentsStream dirStream)
|
S.findM (\(_, p) -> isMatch x p) (dirContentsStream dirStream)
|
||||||
|
@ -168,14 +168,14 @@ liftIOException errType ex =
|
|||||||
. lift
|
. lift
|
||||||
|
|
||||||
|
|
||||||
hideErrorDef :: IOErrorType -> a -> IO a -> IO a
|
hideErrorDef :: [IOErrorType] -> a -> IO a -> IO a
|
||||||
hideErrorDef err def =
|
hideErrorDef errs def =
|
||||||
handleIO (\e -> if err == ioeGetErrorType e then pure def else ioError e)
|
handleIO (\e -> if ioeGetErrorType e `elem` errs then pure def else ioError e)
|
||||||
|
|
||||||
|
|
||||||
hideErrorDefM :: IOErrorType -> IO a -> IO a -> IO a
|
hideErrorDefM :: [IOErrorType] -> IO a -> IO a -> IO a
|
||||||
hideErrorDefM err def =
|
hideErrorDefM errs def =
|
||||||
handleIO (\e -> if err == ioeGetErrorType e then def else ioError e)
|
handleIO (\e -> if ioeGetErrorType e `elem` errs then def else ioError e)
|
||||||
|
|
||||||
|
|
||||||
-- TODO: does this work?
|
-- TODO: does this work?
|
||||||
|
Loading…
Reference in New Issue
Block a user