Source

snaplet-mongoDB / src / Snap / Snaplet / MongoDB.hs

Diff from to

File src/Snap/Snaplet/MongoDB.hs

 import qualified Database.MongoDB.Connection as MongoDB
 import qualified System.IO.Pool as MPool
 
+import           Control.Monad.CatchIO hiding (Handler)
+
+instance Exception String
 
 ------------------------------------------------------------------------------
 -- | The 'MonadMongoDB' class. Minimal complete definition:
   withDB' :: Action IO a -> m a
   withDB' run = do
     r <- withDB run 
-    either (error . show) return r
+    either (throw . show) return r
 
 
 data MongoDBSnaplet = MongoDBSnaplet {
 bs2objid' :: BS.ByteString -> ObjectId
 bs2objid' = fromJust . bs2objid
 
-
 bs2cs :: BS.ByteString -> US.UString
 bs2cs = CSI.CS