summaryrefslogtreecommitdiff
path: root/Database
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-10-12 13:00:22 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-10-12 13:00:22 -0400
commit1fd3a419cc518377bad42c95b6651d1d88c85d5f (patch)
treec488f205e8423c18567afe6b84ee3ea16a088bf5 /Database
parentb3e761b6cf42cb537e7e8e8db4d74b12c7dbfd8a (diff)
avoid ugly error about MVar if the sqlite worker thread crashes
Diffstat (limited to 'Database')
-rw-r--r--Database/Handle.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/Database/Handle.hs b/Database/Handle.hs
index 1fd9f7834..439e7c18b 100644
--- a/Database/Handle.hs
+++ b/Database/Handle.hs
@@ -137,7 +137,8 @@ queryDb (DbHandle _ jobs _) a = do
res <- newEmptyMVar
putMVar jobs $ QueryJob $
liftIO . putMVar res =<< tryNonAsync a
- either throwIO return =<< takeMVar res
+ (either throwIO return =<< takeMVar res)
+ `catchNonAsync` (const $ error "sqlite query crashed")
closeDb :: DbHandle -> IO ()
closeDb h@(DbHandle worker jobs _) = do