i hate this

This commit is contained in:
parsonsmatt 2021-03-29 14:39:37 -06:00
parent 6a6a63cb97
commit 303c65f187

View File

@ -1451,8 +1451,26 @@ migrateIt = do
cleanUniques
withConn :: RunDbMonad m => (SqlBackend -> R.ResourceT m a) -> m a
withConn =
R.runResourceT . withPostgresqlConn "host=localhost port=5432 user=esqutest password=esqutest dbname=esqutest"
withConn f = do
ea <- try go
case ea of
Left (SomeException se) -> do
ea' <- try go
case ea' of
Left (SomeException se1) ->
if show se == show se1
then throwM se
else throwM se1
Right a ->
pure a
Right a ->
pure a
where
go =
R.runResourceT $
withPostgresqlConn
"host=localhost port=5432 user=esqutest password=esqutest dbname=esqutest"
f
-- | Show the SQL generated by a query
showQuery :: (Monad m, ES.SqlSelect a r, BackendCompatible SqlBackend backend)