diff --git a/src/HPath/IO/Errors.hs b/src/HPath/IO/Errors.hs index 770884f..a3534c2 100644 --- a/src/HPath/IO/Errors.hs +++ b/src/HPath/IO/Errors.hs @@ -12,7 +12,44 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE ScopedTypeVariables #-} -module HPath.IO.Errors where +module HPath.IO.Errors + ( + -- * Types + HPathIOException(..) + + -- * Exception identifiers + , isFileDoesNotExist + , isDirDoesNotExist + , isSameFile + , isDestinationInSource + , isFileDoesExist + , isDirDoesExist + , isInvalidOperation + , isCan'tOpenDirectory + , isCopyFailed + + -- * Path based functions + , throwFileDoesExist + , throwDirDoesExist + , throwFileDoesNotExist + , throwDirDoesNotExist + , throwSameFile + , sameFile + , throwDestinationInSource + , doesFileExist + , doesDirectoryExist + , isWritable + , canOpenDirectory + , throwCantOpenDirectory + + -- * Error handling functions + , catchErrno + , rethrowErrnoAs + , handleIOError + , bracketeer + , reactOnError + ) + where import Control.Applicative @@ -98,6 +135,13 @@ instance Show HPathIOException where instance Exception HPathIOException + + + + ----------------------------- + --[ Exception identifiers ]-- + ----------------------------- + isFileDoesNotExist, isDirDoesNotExist, isSameFile, isDestinationInSource, isFileDoesExist, isDirDoesExist, isInvalidOperation, isCan'tOpenDirectory, isCopyFailed :: HPathIOException -> Bool isFileDoesNotExist ex = toConstr (ex :: HPathIOException) == toConstr FileDoesNotExist{} isDirDoesNotExist ex = toConstr (ex :: HPathIOException) == toConstr DirDoesNotExist{}