Copyright | © 2016 Julian Ospald |
---|---|
License | BSD3 |
Maintainer | Julian Ospald <hasufell@posteo.de> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Provides error handling.
- data HPathIOException
- isFileDoesNotExist :: HPathIOException -> Bool
- isDirDoesNotExist :: HPathIOException -> Bool
- isSameFile :: HPathIOException -> Bool
- isDestinationInSource :: HPathIOException -> Bool
- isFileDoesExist :: HPathIOException -> Bool
- isDirDoesExist :: HPathIOException -> Bool
- isInvalidOperation :: HPathIOException -> Bool
- isCan'tOpenDirectory :: HPathIOException -> Bool
- isCopyFailed :: HPathIOException -> Bool
- isRecursiveFailure :: HPathIOException -> Bool
- throwFileDoesExist :: Path Abs -> IO ()
- throwDirDoesExist :: Path Abs -> IO ()
- throwFileDoesNotExist :: Path Abs -> IO ()
- throwDirDoesNotExist :: Path Abs -> IO ()
- throwSameFile :: Path Abs -> Path Abs -> IO ()
- sameFile :: Path Abs -> Path Abs -> IO Bool
- throwDestinationInSource :: Path Abs -> Path Abs -> IO ()
- doesFileExist :: Path Abs -> IO Bool
- doesDirectoryExist :: Path Abs -> IO Bool
- isWritable :: Path Abs -> IO Bool
- canOpenDirectory :: Path Abs -> IO Bool
- throwCantOpenDirectory :: Path Abs -> IO ()
- catchErrno :: [Errno] -> IO a -> IO a -> IO a
- rethrowErrnoAs :: Exception e => [Errno] -> e -> IO a -> IO a
- handleIOError :: (IOError -> IO a) -> IO a -> IO a
- bracketeer :: IO a -> (a -> IO b) -> (a -> IO b) -> (a -> IO c) -> IO c
- reactOnError :: IO a -> [(IOErrorType, IO a)] -> [(HPathIOException, IO a)] -> IO a
Types
data HPathIOException Source #
Exception identifiers
isSameFile :: HPathIOException -> Bool Source #
isCopyFailed :: HPathIOException -> Bool Source #
Path based functions
throwSameFile :: Path Abs -> Path Abs -> IO () Source #
Uses isSameFile
and throws SameFile
if it returns True.
sameFile :: Path Abs -> Path Abs -> IO Bool Source #
Check if the files are the same by examining device and file id. - This follows symbolic links.
throwDestinationInSource Source #
Checks whether the destination directory is contained +
Copyright | © 2016 Julian Ospald |
---|---|
License | BSD3 |
Maintainer | Julian Ospald <hasufell@posteo.de> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Provides error handling.
- data HPathIOException
- isFileDoesNotExist :: HPathIOException -> Bool
- isDirDoesNotExist :: HPathIOException -> Bool
- isSameFile :: HPathIOException -> Bool
- isDestinationInSource :: HPathIOException -> Bool
- isFileDoesExist :: HPathIOException -> Bool
- isDirDoesExist :: HPathIOException -> Bool
- isInvalidOperation :: HPathIOException -> Bool
- isCan'tOpenDirectory :: HPathIOException -> Bool
- isCopyFailed :: HPathIOException -> Bool
- isRecursiveFailure :: HPathIOException -> Bool
- throwFileDoesExist :: Path Abs -> IO ()
- throwDirDoesExist :: Path Abs -> IO ()
- throwFileDoesNotExist :: Path Abs -> IO ()
- throwDirDoesNotExist :: Path Abs -> IO ()
- throwSameFile :: Path Abs -> Path Abs -> IO ()
- sameFile :: Path Abs -> Path Abs -> IO Bool
- throwDestinationInSource :: Path Abs -> Path Abs -> IO ()
- doesFileExist :: Path Abs -> IO Bool
- doesDirectoryExist :: Path Abs -> IO Bool
- isWritable :: Path Abs -> IO Bool
- canOpenDirectory :: Path Abs -> IO Bool
- throwCantOpenDirectory :: Path Abs -> IO ()
- catchErrno :: [Errno] -> IO a -> IO a -> IO a
- rethrowErrnoAs :: Exception e => [Errno] -> e -> IO a -> IO a
- handleIOError :: (IOError -> IO a) -> IO a -> IO a
- bracketeer :: IO a -> (a -> IO b) -> (a -> IO b) -> (a -> IO c) -> IO c
- reactOnError :: IO a -> [(IOErrorType, IO a)] -> [(HPathIOException, IO a)] -> IO a
Types
data HPathIOException Source
Exception identifiers
isSameFile :: HPathIOException -> Bool Source
Path based functions
throwFileDoesExist :: Path Abs -> IO () Source
throwDirDoesExist :: Path Abs -> IO () Source
throwFileDoesNotExist :: Path Abs -> IO () Source
throwDirDoesNotExist :: Path Abs -> IO () Source
throwSameFile :: Path Abs -> Path Abs -> IO () Source
Uses isSameFile
and throws SameFile
if it returns True.
sameFile :: Path Abs -> Path Abs -> IO Bool Source
Check if the files are the same by examining device and file id. + This follows symbolic links.
throwDestinationInSource Source
Checks whether the destination directory is contained within the source directory by comparing the device+file ID of the source directory with all device+file IDs of the parent directories - of the destination.
doesFileExist :: Path Abs -> IO Bool Source #
Checks if the given file exists and is not a directory. - Does not follow symlinks.
doesDirectoryExist :: Path Abs -> IO Bool Source #
Checks if the given file exists and is a directory. - Does not follow symlinks.
canOpenDirectory :: Path Abs -> IO Bool Source #
Checks whether the directory at the given path exists and can be
- opened. This invokes openDirStream
which follows symlinks.
throwCantOpenDirectory :: Path Abs -> IO () Source #
Throws a Can'tOpenDirectory
HPathIOException if the directory at the given
- path cannot be opened.
Error handling functions
:: [Errno] | errno to catch |
-> IO a | action to try, which can raise an IOException |
-> IO a | action to carry out in case of an IOException and - if errno matches |
-> IO a |
Carries out an action, then checks if there is an IOException and + of the destination.
doesFileExist :: Path Abs -> IO Bool Source
Checks if the given file exists and is not a directory. + Does not follow symlinks.
doesDirectoryExist :: Path Abs -> IO Bool Source
Checks if the given file exists and is a directory. + Does not follow symlinks.
canOpenDirectory :: Path Abs -> IO Bool Source
Checks whether the directory at the given path exists and can be
+ opened. This invokes openDirStream
which follows symlinks.
throwCantOpenDirectory :: Path Abs -> IO () Source
Throws a Can'tOpenDirectory
HPathIOException if the directory at the given
+ path cannot be opened.
Error handling functions
:: [Errno] | errno to catch |
-> IO a | action to try, which can raise an IOException |
-> IO a | action to carry out in case of an IOException and + if errno matches |
-> IO a |
Carries out an action, then checks if there is an IOException and a specific errno. If so, then it carries out another action, otherwise - it rethrows the error.
Execute the given action and retrow IO exceptions as a new Exception + it rethrows the error.
Execute the given action and retrow IO exceptions as a new Exception that have the given errno. If errno does not match the exception is rethrown - as is.
handleIOError :: (IOError -> IO a) -> IO a -> IO a Source #
Like catchIOError
, with arguments swapped.
:: IO a | computation to run first |
-> (a -> IO b) | computation to run last, when - no exception was raised |
-> (a -> IO b) | computation to run last, - when an exception was raised |
-> (a -> IO c) | computation to run in-between |
-> IO c |
Like bracket
, but allows to have different clean-up
+ as is.
handleIOError :: (IOError -> IO a) -> IO a -> IO a Source
Like catchIOError
, with arguments swapped.
:: IO a | computation to run first |
-> (a -> IO b) | computation to run last, when + no exception was raised |
-> (a -> IO b) | computation to run last, + when an exception was raised |
-> (a -> IO c) | computation to run in-between |
-> IO c |
Like bracket
, but allows to have different clean-up
actions depending on whether the in-between computation
- has raised an exception or not.
:: IO a | |
-> [(IOErrorType, IO a)] | reaction on IO errors |
-> [(HPathIOException, IO a)] | reaction on HPathIOException |
-> IO a |
:: IO a | |
-> [(IOErrorType, IO a)] | reaction on IO errors |
-> [(HPathIOException, IO a)] | reaction on HPathIOException |
-> IO a |