| Copyright | (c) The University of Glasgow 2001 |
|---|---|
| License | BSD-style (see the file libraries/base/LICENSE) |
| Maintainer | libraries@haskell.org |
| Stability | provisional |
| Portability | portable |
| Safe Haskell | Trustworthy |
| Language | Haskell2010 |
System.IO.Error
Contents
Description
Standard IO Errors.
typeIOError =IOExceptionSource#
The Haskell 2010 type for exceptions in theIO monad. Any I/O operation may raise anIOException instead of returning a result. For a more general type of exception, including also those that arise in pure code, seeException.
In Haskell 2010, this is an opaque type.
userError ::String ->IOErrorSource#
Construct anIOException value with a string describing the error. Thefail method of theIO instance of theMonad class raises auserError, thus:
instance Monad IO where ... fail s = ioError (userError s)
mkIOError ::IOErrorType ->String ->MaybeHandle ->MaybeFilePath ->IOErrorSource#
Construct anIOException of the given type where the second argument describes the error location and the third and fourth argument contain the file handle and file path of the file involved in the error if applicable.
annotateIOError ::IOError ->String ->MaybeHandle ->MaybeFilePath ->IOErrorSource#
Adds a location description and maybe a file path and file handle to anIOException. If any of the file handle or file path is not given the corresponding value in theIOException remains unaltered.
isAlreadyExistsError ::IOError ->BoolSource#
An error indicating that anIO operation failed because one of its arguments already exists.
isDoesNotExistError ::IOError ->BoolSource#
An error indicating that anIO operation failed because one of its arguments does not exist.
isAlreadyInUseError ::IOError ->BoolSource#
An error indicating that anIO operation failed because one of its arguments is a single-use resource, which is already being used (for example, opening the same file twice for writing might give this error).
isFullError ::IOError ->BoolSource#
An error indicating that anIO operation failed because the device is full.
isEOFError ::IOError ->BoolSource#
An error indicating that anIO operation failed because the end of file has been reached.
isIllegalOperation ::IOError ->BoolSource#
An error indicating that anIO operation failed because the operation was not possible. Any computation which returns anIO result may fail withisIllegalOperation. In some cases, an implementation will not be able to distinguish between the possible error causes. In this case it should fail withisIllegalOperation.
isPermissionError ::IOError ->BoolSource#
An error indicating that anIO operation failed because the user does not have sufficient operating system privilege to perform that operation.
An abstract type that contains a value for each variant ofIOException.
| EqIOErrorTypeSource# | Since: 4.1.0.0 |
Instance detailsDefined inGHC.IO.Exception | |
| ShowIOErrorTypeSource# | Since: 4.1.0.0 |
Instance detailsDefined inGHC.IO.Exception | |
alreadyExistsErrorType ::IOErrorTypeSource#
I/O error where the operation failed because one of its arguments already exists.
doesNotExistErrorType ::IOErrorTypeSource#
I/O error where the operation failed because one of its arguments does not exist.
alreadyInUseErrorType ::IOErrorTypeSource#
I/O error where the operation failed because one of its arguments is a single-use resource, which is already being used.
fullErrorType ::IOErrorTypeSource#
I/O error where the operation failed because the device is full.
eofErrorType ::IOErrorTypeSource#
I/O error where the operation failed because the end of file has been reached.
illegalOperationErrorType ::IOErrorTypeSource#
I/O error where the operation is not possible.
permissionErrorType ::IOErrorTypeSource#
I/O error where the operation failed because the user does not have sufficient operating system privilege to perform that operation.
userErrorType ::IOErrorTypeSource#
I/O error that is programmer-defined.
IOErrorType predicatesisAlreadyExistsErrorType ::IOErrorType ->BoolSource#
I/O error where the operation failed because one of its arguments already exists.
isDoesNotExistErrorType ::IOErrorType ->BoolSource#
I/O error where the operation failed because one of its arguments does not exist.
isAlreadyInUseErrorType ::IOErrorType ->BoolSource#
I/O error where the operation failed because one of its arguments is a single-use resource, which is already being used.
isFullErrorType ::IOErrorType ->BoolSource#
I/O error where the operation failed because the device is full.
isEOFErrorType ::IOErrorType ->BoolSource#
I/O error where the operation failed because the end of file has been reached.
isIllegalOperationErrorType ::IOErrorType ->BoolSource#
I/O error where the operation is not possible.
isPermissionErrorType ::IOErrorType ->BoolSource#
I/O error where the operation failed because the user does not have sufficient operating system privilege to perform that operation.
isUserErrorType ::IOErrorType ->BoolSource#
I/O error that is programmer-defined.
catchIOError ::IO a -> (IOError ->IO a) ->IO aSource#
ThecatchIOError function establishes a handler that receives anyIOException raised in the action protected bycatchIOError. AnIOException is caught by the most recent handler established by one of the exception handling functions. These handlers are not selective: allIOExceptions are caught. Exception propagation must be explicitly provided in a handler by re-raising any unwanted exceptions. For example, in
f = catchIOError g (\e -> if IO.isEOFError e then return [] else ioError e)
the functionf returns[] when an end-of-file exception (cf.isEOFError) occurs ing; otherwise, the exception is propagated to the next outer handler.
When an exception propagates outside the main program, the Haskell system prints the associatedIOException value and exits the program.
Non-I/O exceptions are not caught by this variant; to catch all exceptions, usecatch fromControl.Exception.
Since: 4.4.0.0
tryIOError ::IO a ->IO (EitherIOError a)Source#
The constructtryIOErrorcomp exposes IO errors which occur within a computation, and which are not fully handled.
Non-I/O exceptions are not caught by this variant; to catch all exceptions, usetry fromControl.Exception.
Since: 4.4.0.0
modifyIOError :: (IOError ->IOError) ->IO a ->IO aSource#
Catch anyIOException that occurs in the computation and throw a modified version.
Produced byHaddock version 2.20.0