Commits

Anonymous committed 7c994db Merge

Merge branch 'release/0.2.1'

Comments (0)

Files changed (2)

snaplet-mongoDB.cabal

     time >= 1.1 && < 1.5,
     parsec == 3.1.1,
     haskell-src-exts == 1.11.1,
-    template-haskell
+    template-haskell,
+    MonadCatchIO-transformers == 0.2.2.2
   
   -- Extra tools (e.g. alex, hsc2hs, ...) needed to build the source.
   -- Build-tools:    

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