@@ -14,10 +14,8 @@ module Database.PostgreSQL.Simple.Errors
1414 )
1515 where
1616
17−import Prelude hiding (catch)
18−
1917import Control.Applicative
20−import Control.Exception
18+import Control.Exception as E
2119
2220import Data.Attoparsec.Char8
2321import Data.ByteString (ByteString)
@@ -75,7 +73,7 @@ constraintViolation e =
7573-- > createUser = catchJust constraintViolationE catcher $ execute conn ...
7674-- > where
7775-- > catcher (_, UniqueViolation "user_login_key") = ...
78−-- > catcher (e, _) = throw e
76+-- > catcher (e, _) = throwIO e
7977--
8078constraintViolationE :: SqlError -> Maybe (SqlError, ConstraintViolation)
8179constraintViolationE e = fmap ((,) e) $ constraintViolation e
@@ -86,10 +84,10 @@ constraintViolationE e = fmap ((,) e) $ constraintViolation e
8684-- > createUser = catchViolation catcher $ execute conn ...
8785-- > where
8886-- > catcher _ (UniqueViolation "user_login_key") = ...
89−-- > catcher e _ = throw e
87+-- > catcher e _ = throwIO e
9088catchViolation :: (SqlError -> ConstraintViolation -> IO a) -> IO a -> IO a
91−catchViolation f m = catch m
92− (\e -> maybe (throw e) (f e) $ constraintViolation e)
89+catchViolation f m = E.catch m
90+ (\e -> maybe (throwIO e) (f e) $ constraintViolation e)
9391
9492-- Parsers just try to extract quoted strings from error messages, number
9593-- of quoted strings depend on error type.