Safe Haskell | None |
---|---|
Language | Haskell2010 |
Panic
Synopsis
- data GhcException
- showGhcException :: GhcException -> ShowS
- throwGhcException :: GhcException -> a
- throwGhcExceptionIO :: GhcException -> IO a
- handleGhcException :: ExceptionMonad m => (GhcException -> m a) -> m a -> m a
- progName :: String
- pgmError :: String -> a
- panic :: String -> a
- sorry :: String -> a
- assertPanic :: String -> Int -> a
- trace :: String -> a -> a
- panicDoc :: String -> SDoc -> a
- sorryDoc :: String -> SDoc -> a
- pgmErrorDoc :: String -> SDoc -> a
- cmdLineError :: String -> a
- cmdLineErrorIO :: String -> IO a
- class (Typeable e, Show e) => Exception e where
- toException :: e -> SomeException
- fromException :: SomeException -> Maybe e
- displayException :: e -> String
- showException :: Exception e => e -> String
- safeShowException :: Exception e => e -> IO String
- try :: Exception e => IO a -> IO (Either e a)
- tryMost :: IO a -> IO (Either SomeException a)
- throwTo :: Exception e => ThreadId -> e -> IO ()
- withSignalHandlers :: (ExceptionMonad m, MonadIO m) => m a -> m a
Documentation
data GhcException Source #
GHC's own exception type error messages all take the form:
location: error
If the location is on the command line, or in GHC itself, then location="ghc". All of the error types below correspond to a location of "ghc", except for ProgramError (where the string is assumed to contain a location already, so we don't print one).
Constructors
Signal Int | Some other fatal signal (SIGHUP,SIGTERM) |
UsageError String | Prints the short usage msg after the error |
CmdLineError String | A problem with the command line arguments, but don't print usage. |
Panic String | The |
PprPanic String SDoc | |
Sorry String | The user tickled something that's known not to work yet, but we're not counting it as a bug. |
PprSorry String SDoc | |
InstallationError String | An installation problem. |
ProgramError String | An error in the user's code, probably. |
PprProgramError String SDoc |
Instances
Show GhcException Source # | |
Defined in Panic Methods showsPrec :: Int -> GhcException -> ShowS # show :: GhcException -> String # showList :: [GhcException] -> ShowS # | |
Exception GhcException Source # | |
Defined in Panic Methods toException :: GhcException -> SomeException # fromException :: SomeException -> Maybe GhcException # displayException :: GhcException -> String # |
showGhcException :: GhcException -> ShowS Source #
Append a description of the given exception to this string.
Note that this uses unsafeGlobalDynFlags
, which may have some
uninitialized fields if invoked before initGhcMonad
has been called.
If the error message to be printed includes a pretty-printer document
which forces one of these fields this call may bottom.
throwGhcException :: GhcException -> a Source #
throwGhcExceptionIO :: GhcException -> IO a Source #
handleGhcException :: ExceptionMonad m => (GhcException -> m a) -> m a -> m a Source #
assertPanic :: String -> Int -> a Source #
Throw a failed assertion exception for a given filename and line number.
pgmErrorDoc :: String -> SDoc -> a Source #
cmdLineError :: String -> a Source #
cmdLineErrorIO :: String -> IO a Source #
class (Typeable e, Show e) => Exception e where #
Minimal complete definition
Nothing
Methods
toException :: e -> SomeException #
fromException :: SomeException -> Maybe e #
displayException :: e -> String #
Instances
Exception AllocationLimitExceeded | |
Defined in GHC.IO.Exception Methods toException :: AllocationLimitExceeded -> SomeException # fromException :: SomeException -> Maybe AllocationLimitExceeded # displayException :: AllocationLimitExceeded -> String # | |
Exception ArrayException | |
Defined in GHC.IO.Exception Methods toException :: ArrayException -> SomeException # fromException :: SomeException -> Maybe ArrayException # displayException :: ArrayException -> String # | |
Exception AssertionFailed | |
Defined in GHC.IO.Exception Methods toException :: AssertionFailed -> SomeException # fromException :: SomeException -> Maybe AssertionFailed # displayException :: AssertionFailed -> String # | |
Exception AsyncException | |
Defined in GHC.IO.Exception Methods toException :: AsyncException -> SomeException # fromException :: SomeException -> Maybe AsyncException # displayException :: AsyncException -> String # | |
Exception BlockedIndefinitelyOnMVar | |
Defined in GHC.IO.Exception Methods toException :: BlockedIndefinitelyOnMVar -> SomeException # fromException :: SomeException -> Maybe BlockedIndefinitelyOnMVar # displayException :: BlockedIndefinitelyOnMVar -> String # | |
Exception BlockedIndefinitelyOnSTM | |
Defined in GHC.IO.Exception Methods toException :: BlockedIndefinitelyOnSTM -> SomeException # fromException :: SomeException -> Maybe BlockedIndefinitelyOnSTM # displayException :: BlockedIndefinitelyOnSTM -> String # | |
Exception CompactionFailed | |
Defined in GHC.IO.Exception Methods toException :: CompactionFailed -> SomeException # fromException :: SomeException -> Maybe CompactionFailed # displayException :: CompactionFailed -> String # | |
Exception Deadlock | |
Defined in GHC.IO.Exception Methods toException :: Deadlock -> SomeException # fromException :: SomeException -> Maybe Deadlock # displayException :: Deadlock -> String # | |
Exception ExitCode | |
Defined in GHC.IO.Exception Methods toException :: ExitCode -> SomeException # fromException :: SomeException -> Maybe ExitCode # displayException :: ExitCode -> String # | |
Exception FixIOException | |
Defined in GHC.IO.Exception Methods toException :: FixIOException -> SomeException # fromException :: SomeException -> Maybe FixIOException # displayException :: FixIOException -> String # | |
Exception IOException | |
Defined in GHC.IO.Exception Methods toException :: IOException -> SomeException # fromException :: SomeException -> Maybe IOException # displayException :: IOException -> String # | |
Exception SomeAsyncException | |
Defined in GHC.IO.Exception Methods toException :: SomeAsyncException -> SomeException # fromException :: SomeException -> Maybe SomeAsyncException # displayException :: SomeAsyncException -> String # | |
Exception SomeException | |
Defined in GHC.Exception.Type Methods toException :: SomeException -> SomeException # fromException :: SomeException -> Maybe SomeException # displayException :: SomeException -> String # | |
Exception GhcApiError Source # | |
Defined in HscTypes Methods toException :: GhcApiError -> SomeException # fromException :: SomeException -> Maybe GhcApiError # displayException :: GhcApiError -> String # | |
Exception SourceError Source # | |
Defined in HscTypes Methods toException :: SourceError -> SomeException # fromException :: SomeException -> Maybe SourceError # displayException :: SourceError -> String # | |
Exception Void | |
Defined in Data.Void Methods toException :: Void -> SomeException # fromException :: SomeException -> Maybe Void # displayException :: Void -> String # | |
Exception NestedAtomically | |
Defined in Control.Exception.Base Methods toException :: NestedAtomically -> SomeException # fromException :: SomeException -> Maybe NestedAtomically # displayException :: NestedAtomically -> String # | |
Exception NoMethodError | |
Defined in Control.Exception.Base Methods toException :: NoMethodError -> SomeException # fromException :: SomeException -> Maybe NoMethodError # displayException :: NoMethodError -> String # | |
Exception NonTermination | |
Defined in Control.Exception.Base Methods toException :: NonTermination -> SomeException # fromException :: SomeException -> Maybe NonTermination # displayException :: NonTermination -> String # | |
Exception PatternMatchFail | |
Defined in Control.Exception.Base Methods toException :: PatternMatchFail -> SomeException # fromException :: SomeException -> Maybe PatternMatchFail # displayException :: PatternMatchFail -> String # | |
Exception RecConError | |
Defined in Control.Exception.Base Methods toException :: RecConError -> SomeException # fromException :: SomeException -> Maybe RecConError # displayException :: RecConError -> String # | |
Exception RecSelError | |
Defined in Control.Exception.Base Methods toException :: RecSelError -> SomeException # fromException :: SomeException -> Maybe RecSelError # displayException :: RecSelError -> String # | |
Exception RecUpdError | |
Defined in Control.Exception.Base Methods toException :: RecUpdError -> SomeException # fromException :: SomeException -> Maybe RecUpdError # displayException :: RecUpdError -> String # | |
Exception TypeError | |
Defined in Control.Exception.Base Methods toException :: TypeError -> SomeException # fromException :: SomeException -> Maybe TypeError # displayException :: TypeError -> String # | |
Exception ErrorCall | |
Defined in GHC.Exception Methods toException :: ErrorCall -> SomeException # fromException :: SomeException -> Maybe ErrorCall # displayException :: ErrorCall -> String # | |
Exception ArithException | |
Defined in GHC.Exception.Type Methods toException :: ArithException -> SomeException # fromException :: SomeException -> Maybe ArithException # displayException :: ArithException -> String # | |
Exception FileLockingNotSupported | |
Defined in GHC.IO.Handle.Lock Methods toException :: FileLockingNotSupported -> SomeException # fromException :: SomeException -> Maybe FileLockingNotSupported # displayException :: FileLockingNotSupported -> String # | |
Exception Dynamic | |
Defined in Data.Dynamic Methods toException :: Dynamic -> SomeException # fromException :: SomeException -> Maybe Dynamic # displayException :: Dynamic -> String # | |
Exception GhcException Source # | |
Defined in Panic Methods toException :: GhcException -> SomeException # fromException :: SomeException -> Maybe GhcException # displayException :: GhcException -> String # | |
Exception IOEnvFailure Source # | |
Defined in IOEnv Methods toException :: IOEnvFailure -> SomeException # fromException :: SomeException -> Maybe IOEnvFailure # displayException :: IOEnvFailure -> String # |
showException :: Exception e => e -> String Source #
Show an exception as a string.
safeShowException :: Exception e => e -> IO String Source #
Show an exception which can possibly throw other exceptions. Used when displaying exception thrown within TH code.
tryMost :: IO a -> IO (Either SomeException a) Source #
Like try, but pass through UserInterrupt and Panic exceptions. Used when we want soft failures when reading interface files, for example. TODO: I'm not entirely sure if this is catching what we really want to catch
withSignalHandlers :: (ExceptionMonad m, MonadIO m) => m a -> m a Source #
Temporarily install standard signal handlers for catching ^C, which just throw an exception in the current thread.