@@ -50,7 +50,7 @@ module Squeal.PostgreSQL.PQ
50 , MonadPQ (..)
50 , MonadPQ (..)
52 , pqliftWith
52 , pqliftWith
53− -- * Result
53+ -- * Results
54 , LibPQ.Result
54 , LibPQ.Result
55 , LibPQ.Row
55 , LibPQ.Row
@@ -63,7 +63,10 @@ module Squeal.PostgreSQL.PQ
63 , resultStatus
63 , resultStatus
64 , resultErrorMessage
64 , resultErrorMessage
65 , resultErrorCode
65 , resultErrorCode
66 , SquealException (..)
67 , SquealException (..)
69import Control.Exception.Lifted
72import Control.Exception.Lifted
@@ -651,3 +654,18 @@ tryResult result = liftBase $ do
651 stateCode <- LibPQ.resultErrorField result LibPQ.DiagSqlstate
654 stateCode <- LibPQ.resultErrorField result LibPQ.DiagSqlstate
652 msg <- LibPQ.resultErrorMessage result
655 msg <- LibPQ.resultErrorMessage result
653 throw $ PQException status stateCode msg
656 throw $ PQException status stateCode msg
658+-- | Catch `SquealException`s.
660+ :: MonadBaseControl IO io
662+ -> (SquealException -> io a) -- ^ handler
666+-- | Handle `SquealExceptions`s.
668+ :: MonadBaseControl IO io
669+ => (SquealException -> io a) -- ^ handler
671+handleSqueal = handle