git.iko.soy/typeable/postgresql-simple
on master help sign in
Only catch SqlError in retryLoop
commit10d291359d5a5719e546da6b827bf8df0ab2d5ad authorElliot Cameron <eacameron@gmail.com> dateTue 15 Oct 2019, 10:46 (7 years ago) parent61837eb
1 file changed+4−4
src/Database/PostgreSQL/Simple/Transaction.hs+4−4
src/Database/PostgreSQL/Simple/Transaction.hs+4−4
@@ -161,15 +161,15 @@ withTransactionModeRetry mode shouldRetry conn act =
161161 commit conn
162162 return a
163163 where
164− retryLoop :: IO (Either E.SomeException a) -> IO a
164+ retryLoop :: IO (Either SqlError a) -> IO a
165165 retryLoop act' = do
166166 beginMode mode conn
167167 r <- act'
168168 case r of
169169 Left e ->
170− case fmap shouldRetry (E.fromException e) of
171− Just True -> retryLoop act'
172− _ -> E.throwIO e
170+ case shouldRetry e of
171+ True -> retryLoop act'
172+ False -> E.throwIO e
173173 Right a ->
174174 return a
175175