module Database.PostgreSQL.PQTypes.Internal.Exception (
DBException(..)
, rethrowWithContext
) where
import qualified Control.Exception as E
import Database.PostgreSQL.PQTypes.SQL.Class
data DBException = forall e sql. (E.Exception e, Show sql) => DBException
{
()
dbeQueryContext :: !sql
, ()
dbeError :: !e
}
deriving instance Show DBException
instance E.Exception DBException
rethrowWithContext :: IsSQL sql => sql -> E.SomeException -> IO a
rethrowWithContext :: forall sql a. IsSQL sql => sql -> SomeException -> IO a
rethrowWithContext sql
sql (E.SomeException e
e) = forall e a. Exception e => e -> IO a
E.throwIO DBException {
dbeQueryContext :: sql
dbeQueryContext = sql
sql
, dbeError :: e
dbeError = e
e
}