From 303c65f18777fac909253dd5cde48cd30c799429 Mon Sep 17 00:00:00 2001 From: parsonsmatt Date: Mon, 29 Mar 2021 14:39:37 -0600 Subject: [PATCH] i hate this --- test/PostgreSQL/Test.hs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/test/PostgreSQL/Test.hs b/test/PostgreSQL/Test.hs index 8068cb0..d36ebf8 100644 --- a/test/PostgreSQL/Test.hs +++ b/test/PostgreSQL/Test.hs @@ -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)