diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-28 20:29:44 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-28 20:29:44 +0400 |
commit | 1bc109b89d73cbd36ad4b03f5ff4d094b24f0c7d (patch) | |
tree | 5251acf33b448359a0d3871c45672cc3bea31533 /src | |
parent | 6943ed2b9c7a4bb9a066a42a4611c2158e2e5282 (diff) |
Catch HttpException from setUri function
Diffstat (limited to 'src')
-rw-r--r-- | src/Network/BitTorrent/Tracker/RPC/HTTP.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Network/BitTorrent/Tracker/RPC/HTTP.hs b/src/Network/BitTorrent/Tracker/RPC/HTTP.hs index 37ddb5ad..33ceb077 100644 --- a/src/Network/BitTorrent/Tracker/RPC/HTTP.hs +++ b/src/Network/BitTorrent/Tracker/RPC/HTTP.hs | |||
@@ -127,9 +127,9 @@ fillRequest Options {..} q r = r | |||
127 | | otherwise = a <> "&" <> b | 127 | | otherwise = a <> "&" <> b |
128 | 128 | ||
129 | httpTracker :: BEncode a => Manager -> URI -> SimpleQuery -> IO a | 129 | httpTracker :: BEncode a => Manager -> URI -> SimpleQuery -> IO a |
130 | httpTracker Manager {..} uri q = do | 130 | httpTracker Manager {..} uri q = packHttpException $ do |
131 | request <- fillRequest options q <$> setUri def uri | 131 | request <- fillRequest options q <$> setUri def uri |
132 | response <- packHttpException $ runResourceT $ httpLbs request httpMgr | 132 | response <- runResourceT $ httpLbs request httpMgr |
133 | case BE.decode $ BL.toStrict $ responseBody response of | 133 | case BE.decode $ BL.toStrict $ responseBody response of |
134 | Left msg -> throwIO (ParserFailure msg) | 134 | Left msg -> throwIO (ParserFailure msg) |
135 | Right info -> return info | 135 | Right info -> return info |