The module Foreign.C.Error facilitates C-specific error handling of errno.
| newtype Errno |
| = | Errno CInt | |
Haskell representation for errno values. The implementation is deliberately exposed, to allow users to add their own definitions of Errno values.
| instance Eq Errno |
Different operating systems and/or C libraries often support different values of errno. This module defines the common values, but due to the open definition of Errno users may add definitions which are not predefined.
| isValidErrno :: Errno -> Bool |
| getErrno :: IO Errno |
| resetErrno :: IO () |
| errnoToIOError |
| :: | String | the location where the error occurred |
| -> | Errno | the error number |
| -> | Maybe Handle | optional handle associated with the error |
| -> | Maybe String | optional filename associated with the error |
| -> | IOError | |
Construct an IOError based on the given Errno value. The optional information can be used to improve the accuracy of error messages.
| throwErrno |
| :: | String | textual description of the error location |
| -> | IO a | |
Throw an IOError corresponding to the current value of getErrno.
| throwErrnoIf |
| :: | (a -> Bool) | predicate to apply to the result value of the IO operation |
| -> | String | textual description of the location |
| -> | IO a | the IO operation to be executed |
| -> | IO a | |
Throw an IOError corresponding to the current value of getErrno if the result value of the IO action meets the given predicate.
| throwErrnoIf_ :: (a -> Bool) -> String -> IO a -> IO () |
| throwErrnoIfRetry :: (a -> Bool) -> String -> IO a -> IO a |
| throwErrnoIfRetry_ :: (a -> Bool) -> String -> IO a -> IO () |
| throwErrnoIfMinus1 :: Num a => String -> IO a -> IO a |
| throwErrnoIfMinus1_ :: Num a => String -> IO a -> IO () |
| throwErrnoIfMinus1Retry :: Num a => String -> IO a -> IO a |
| throwErrnoIfMinus1Retry_ :: Num a => String -> IO a -> IO () |
| throwErrnoIfNull :: String -> IO (Ptr a) -> IO (Ptr a) |
| throwErrnoIfNullRetry :: String -> IO (Ptr a) -> IO (Ptr a) |
| throwErrnoIfRetryMayBlock |
as throwErrnoIfRetry, but additionally if the operation yields the error code eAGAIN or eWOULDBLOCK, an alternative action is executed before retrying.
| throwErrnoIfRetryMayBlock_ :: (a -> Bool) |
| -> String -> IO a -> IO b -> IO () |
| throwErrnoIfMinus1RetryMayBlock :: Num a => String |
| -> IO a -> IO b -> IO a |
| throwErrnoIfMinus1RetryMayBlock_ :: Num a => String |
| -> IO a -> IO b -> IO () |
| throwErrnoIfNullRetryMayBlock :: String |
| -> IO (Ptr a) -> IO b -> IO (Ptr a) |
| throwErrnoPath :: String -> FilePath -> IO a |
| throwErrnoPathIf :: (a -> Bool) |
| -> String -> FilePath -> IO a -> IO a |
| throwErrnoPathIf_ :: (a -> Bool) |
| -> String -> FilePath -> IO a -> IO () |
| throwErrnoPathIfNull :: String |
| -> FilePath -> IO (Ptr a) -> IO (Ptr a) |
| throwErrnoPathIfMinus1 :: Num a => String |
| -> FilePath -> IO a -> IO a |
| throwErrnoPathIfMinus1_ :: Num a => String |
| -> FilePath -> IO a -> IO () |