Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
- newtype PartialHandler a = PartialHandler (SomeException -> Maybe (IO a))
- type TotalHandler a = SomeException -> IO a
- totalize :: PartialHandler a -> TotalHandler a
- totalizeRethrowing :: PartialHandler a -> TotalHandler a
- totalizeRethrowingTo :: ThreadId -> PartialHandler a -> TotalHandler a
- totalizeRethrowingTo_ :: ThreadId -> PartialHandler () -> TotalHandler ()
- typed :: Exception e => (e -> Maybe (IO a)) -> PartialHandler a
- onThreadKilled :: IO a -> PartialHandler a
- onIOErrorByType :: (IOErrorType -> Maybe (IO a)) -> PartialHandler a
- onAlreadyExists :: IO a -> PartialHandler a
- onDoesNotExist :: IO a -> PartialHandler a
- onAlreadyInUse :: IO a -> PartialHandler a
- onFull :: IO a -> PartialHandler a
- onEOF :: IO a -> PartialHandler a
- onIllegalOperation :: IO a -> PartialHandler a
- onPermission :: IO a -> PartialHandler a
- onUser :: IO a -> PartialHandler a
Documentation
newtype PartialHandler a Source
A composable exception handler.
PartialHandler (SomeException -> Maybe (IO a)) |
Monoid (PartialHandler a) |
Totalizers
type TotalHandler a = SomeException -> IO a Source
totalize :: PartialHandler a -> TotalHandler a Source
Convert a partial handler into a total handler, which throws an error for unhandled cases. In other words, the produced total handler is itself a partial function, so use this only in cases when an unhandled exception should be considered as a bug.
totalizeRethrowing :: PartialHandler a -> TotalHandler a Source
Convert a partial handler into a total handler, which rethrows all unhandled exceptions.
totalizeRethrowingTo :: ThreadId -> PartialHandler a -> TotalHandler a Source
Convert a partial handler into a total handler, which rethrows all unhandled exceptions to the specified thread and the current thread.
totalizeRethrowingTo_ :: ThreadId -> PartialHandler () -> TotalHandler () Source
Convert a partial handler into a total handler, which rethrows all unhandled exceptions to the specified thread, while the current thread continues the execution.
Standard handlers
typed :: Exception e => (e -> Maybe (IO a)) -> PartialHandler a Source
A handler of exceptions of a specific type.
AsyncException handlers
onThreadKilled :: IO a -> PartialHandler a Source
A handler of the ThreadKilled
exception.
IOError handlers
onIOErrorByType :: (IOErrorType -> Maybe (IO a)) -> PartialHandler a Source
A handler of all exceptions of type IOError
by their type.
onAlreadyExists :: IO a -> PartialHandler a Source
A handler of an IOError
exception
with type satisfying the isAlreadyExistsError
predicate.
onDoesNotExist :: IO a -> PartialHandler a Source
A handler of an IOError
exception
with type satisfying the isDoesNotExistError
predicate.
onAlreadyInUse :: IO a -> PartialHandler a Source
A handler of an IOError
exception
with type satisfying the isAlreadyInUseError
predicate.
onFull :: IO a -> PartialHandler a Source
A handler of an IOError
exception
with type satisfying the isFullError
predicate.
onEOF :: IO a -> PartialHandler a Source
A handler of an IOError
exception
with type satisfying the isEOFError
predicate.
onIllegalOperation :: IO a -> PartialHandler a Source
A handler of an IOError
exception
with type satisfying the isIllegalOperation
predicate.
onPermission :: IO a -> PartialHandler a Source
A handler of an IOError
exception
with type satisfying the isPermissionError
predicate.
onUser :: IO a -> PartialHandler a Source
A handler of an IOError
exception
with type satisfying the isUserError
predicate.