@@ -66,10 +66,10 @@ instance Exception ConstraintViolation
66-- | Tries to convert 'SqlError' to 'ConstrainViolation', checks sqlState and
66-- | Tries to convert 'SqlError' to 'ConstrainViolation', checks sqlState and
67-- succeedes only if able to parse sqlErrorMsg.
67-- succeedes only if able to parse sqlErrorMsg.
69−-- > createUser = catchJust constraintViolation catcher $ execute conn ...
69+-- > createUser = handleJust constraintViolation handler $ execute conn ...
71−-- > catcher UniqueViolation "user_login_key" = ...
71+-- > handler (UniqueViolation "user_login_key") = ...
72−-- > catcher _ = ...
72+-- > handler _ = ...
73constraintViolation :: SqlError -> Maybe ConstraintViolation
73constraintViolation :: SqlError -> Maybe ConstraintViolation
74constraintViolation e =
74constraintViolation e =
75 case sqlState e of
75 case sqlState e of
@@ -84,16 +84,16 @@ constraintViolation e =
85-- | Like constraintViolation, but also packs original SqlError.
85-- | Like constraintViolation, but also packs original SqlError.
87−-- > createUser = catchJust constraintViolationE catcher $ execute conn ...
87+-- > createUser = handleJust constraintViolationE handler $ execute conn ...
89−-- > catcher (_, UniqueViolation "user_login_key") = ...
89+-- > handler (_, UniqueViolation "user_login_key") = ...
90−-- > catcher (e, _) = throwIO e
90+-- > handler (e, _) = throwIO e
92constraintViolationE :: SqlError -> Maybe (SqlError, ConstraintViolation)
92constraintViolationE :: SqlError -> Maybe (SqlError, ConstraintViolation)
93constraintViolationE e = fmap ((,) e) $ constraintViolation e
93constraintViolationE e = fmap ((,) e) $ constraintViolation e
95-- | Catches SqlError, tries to convert to ConstraintViolation, re-throws
95-- | Catches SqlError, tries to convert to ConstraintViolation, re-throws
96−-- on fail. Provides alternative interface to catchJust
96+-- on fail. Provides alternative interface to 'E.handleJust'
98-- > createUser = catchViolation catcher $ execute conn ...
98-- > createUser = catchViolation catcher $ execute conn ...