Created
November 18, 2015 21:16
-
-
Save glasserc/3f45ffbc4b461ea68ca6 to your computer and use it in GitHub Desktop.
mongo-bug: ConnectionFailure <socket: 3>: hPutBuf: illegal operation (handle is closed)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings, ExtendedDefaultRules #-} | |
import Database.MongoDB | |
import Control.Exception | |
import Control.Monad.Trans (liftIO) | |
main = do | |
pipe <- connect (host "127.0.0.1") | |
e1 <- access pipe master "baseball" badQuery `catch` recover | |
e2 <- access pipe master "baseball" goodQuery | |
close pipe | |
print e2 | |
badQuery = findOne $ select [error "argh!!!"] "team" | |
goodQuery = findOne $ select ["name" =: "Yankees"] "team" | |
recover :: SomeException -> IO (Maybe Document) | |
recover e = return Nothing |
It will be fixed in mongodb driver 2.1.0. Yet to be released though.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Did you find a solution for this? I just got the same bug.