Safe Haskell | Trustworthy |
---|---|
Language | Haskell2010 |
This module exports exception types thrown in response to label
failures. In addition, it provides withContext
, a function that
annotates any exceptions in the AnyLabelError
hierarchy that are
thrown within a given scope. These annotations should be used to add
function names to exceptions, so as to make it easier to pinpoint the
cause of a label error.
Synopsis
- class Annotatable e where
- withContext :: String -> LIO l a -> LIO l a
- data AnyLabelError = (Exception e, Annotatable e) => AnyLabelError e
- lerrToException :: (Exception e, Annotatable e) => e -> SomeException
- lerrFromException :: Exception e => SomeException -> Maybe e
- data GenericPrivDesc l = PrivDesc l p => GenericPrivDesc p
- data LabelError l = LabelError {
- lerrContext :: [String]
- lerrFailure :: String
- lerrCurLabel :: l
- lerrCurClearance :: l
- lerrPrivs :: [GenericPrivDesc l]
- lerrLabels :: [l]
- labelError :: Label l => String -> [l] -> LIO l a
- labelErrorP :: (Label l, PrivDesc l p) => String -> Priv p -> [l] -> LIO l a
- data InsufficientPrivs = SpeaksFor p => InsufficientPrivs {
- inspContext :: [String]
- inspFailure :: String
- inspSupplied :: p
- inspNeeded :: p
- insufficientPrivs :: SpeaksFor p => String -> p -> p -> a
- data ResultExceedsLabel l = ResultExceedsLabel {
- relContext :: [String]
- relLocation :: String
- relDeclaredLabel :: l
- relActualLabel :: Maybe l
Documentation
class Annotatable e where Source #
Class of error messages that can be annotated with context.
Instances
Annotatable InsufficientPrivs Source # | |
Defined in LIO.Error annotate :: String -> InsufficientPrivs -> InsufficientPrivs Source # | |
Annotatable AnyLabelError Source # | |
Defined in LIO.Error annotate :: String -> AnyLabelError -> AnyLabelError Source # | |
Annotatable (ResultExceedsLabel l) Source # | |
Defined in LIO.Error annotate :: String -> ResultExceedsLabel l -> ResultExceedsLabel l Source # | |
Annotatable (LabelError l) Source # | |
Defined in LIO.Error annotate :: String -> LabelError l -> LabelError l Source # |
withContext :: String -> LIO l a -> LIO l a Source #
Executes an action with a context string, which will be added to any label exception thrown.
Note: this function wraps an action with a catch
, and thus may
incur a small runtime cost (though it is well under 100 ns on
machines we benchmarked).
data AnyLabelError Source #
Parent of all label-related exceptions.
(Exception e, Annotatable e) => AnyLabelError e |
Instances
Show AnyLabelError Source # | |
Defined in LIO.Error showsPrec :: Int -> AnyLabelError -> ShowS # show :: AnyLabelError -> String # showList :: [AnyLabelError] -> ShowS # | |
Exception AnyLabelError Source # | |
Defined in LIO.Error | |
Annotatable AnyLabelError Source # | |
Defined in LIO.Error annotate :: String -> AnyLabelError -> AnyLabelError Source # |
lerrToException :: (Exception e, Annotatable e) => e -> SomeException Source #
Definition of toException
for children of AnyLabelError
in
the exception hierarchy.
lerrFromException :: Exception e => SomeException -> Maybe e Source #
Definition of fromException
for children of AnyLabelError
in
the exception hierarchy.
data GenericPrivDesc l Source #
A generic privilege description for recording relevant privileges in exceptions.
PrivDesc l p => GenericPrivDesc p |
Instances
Show (GenericPrivDesc l) Source # | |
Defined in LIO.Error showsPrec :: Int -> GenericPrivDesc l -> ShowS # show :: GenericPrivDesc l -> String # showList :: [GenericPrivDesc l] -> ShowS # |
data LabelError l Source #
Main error type thrown by label failures in the LIO
monad.
LabelError | |
|
Instances
Show l => Show (LabelError l) Source # | |
Defined in LIO.Error showsPrec :: Int -> LabelError l -> ShowS # show :: LabelError l -> String # showList :: [LabelError l] -> ShowS # | |
Label l => Exception (LabelError l) Source # | |
Defined in LIO.Error toException :: LabelError l -> SomeException # fromException :: SomeException -> Maybe (LabelError l) # displayException :: LabelError l -> String # | |
Annotatable (LabelError l) Source # | |
Defined in LIO.Error annotate :: String -> LabelError l -> LabelError l Source # |
Throw a label-error exception.
:: (Label l, PrivDesc l p) | |
=> String | Function that failed. |
-> Priv p | Privileges involved. |
-> [l] | Labels involved. |
-> LIO l a |
Throw a label-error exception.
data InsufficientPrivs Source #
Error indicating insufficient privileges (independent of the
current label). This exception is thrown by delegate
, and
should also be thrown by gates that receive insufficient privilege
descriptions (see LIO.Delegate).
SpeaksFor p => InsufficientPrivs | |
|
Instances
Show InsufficientPrivs Source # | |
Defined in LIO.Error showsPrec :: Int -> InsufficientPrivs -> ShowS # show :: InsufficientPrivs -> String # showList :: [InsufficientPrivs] -> ShowS # | |
Exception InsufficientPrivs Source # | |
Defined in LIO.Error | |
Annotatable InsufficientPrivs Source # | |
Defined in LIO.Error annotate :: String -> InsufficientPrivs -> InsufficientPrivs Source # |
:: SpeaksFor p | |
=> String | Function in which error occurs |
-> p | Description of privileges supplied |
-> p | Description of privileges needed |
-> a |
Raise InsufficientPrivs
error.
data ResultExceedsLabel l Source #
Error raised when a computation spawned by lFork
terminates
with its current label above the label of the result.
ResultExceedsLabel | |
|
Instances
Show l => Show (ResultExceedsLabel l) Source # | |
Defined in LIO.Error showsPrec :: Int -> ResultExceedsLabel l -> ShowS # show :: ResultExceedsLabel l -> String # showList :: [ResultExceedsLabel l] -> ShowS # | |
Label l => Exception (ResultExceedsLabel l) Source # | |
Defined in LIO.Error toException :: ResultExceedsLabel l -> SomeException # fromException :: SomeException -> Maybe (ResultExceedsLabel l) # displayException :: ResultExceedsLabel l -> String # | |
Annotatable (ResultExceedsLabel l) Source # | |
Defined in LIO.Error annotate :: String -> ResultExceedsLabel l -> ResultExceedsLabel l Source # |