Files
postgrest/src/Panic.hs
T
Ian JeffriesandStephen Diehl 51fdf38c71 Rename msg to fatalErrorMessage. (#34)
This is to free up `msg` as a variable name.
2017-01-01 18:45:08 -05:00

22 lines
445 B
Haskell

{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE DeriveDataTypeable #-}
module Panic (
FatalError(..),
panic,
) where
import Base (Show)
import Data.Text (Text)
import Data.Typeable (Typeable)
import Control.Exception as X
-- | Uncatchable exceptions thrown and never caught.
data FatalError = FatalError { fatalErrorMessage :: Text }
deriving (Show, Typeable)
instance Exception FatalError
panic :: Text -> a
panic a = throw (FatalError a)