From 4fa86bf2814eac33ddcd6fe16a2d9c6110d1064d Mon Sep 17 00:00:00 2001 From: Sam Truzjan Date: Thu, 27 Feb 2014 16:38:49 +0400 Subject: s/UnrecognizedProtocol/UnrecognizedScheme --- src/Network/BitTorrent/Tracker/RPC.hs | 4 ++-- tests/Network/BitTorrent/Tracker/RPCSpec.hs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Network/BitTorrent/Tracker/RPC.hs b/src/Network/BitTorrent/Tracker/RPC.hs index b3e962fa..cdc7d494 100644 --- a/src/Network/BitTorrent/Tracker/RPC.hs +++ b/src/Network/BitTorrent/Tracker/RPC.hs @@ -139,7 +139,7 @@ withManager opts info = bracket (newManager opts info) closeManager data RpcException = UdpException UDP.RpcException -- ^ UDP RPC driver failure; | HttpException HTTP.RpcException -- ^ HTTP RPC driver failure; - | UnrecognizedProtocol String -- ^ unsupported scheme in announce URI; + | UnrecognizedScheme String -- ^ unsupported scheme in announce URI; | GenericException String -- ^ for furter extensibility. deriving (Show, Typeable) @@ -158,7 +158,7 @@ dispatch URI {..} http udp | uriScheme == "http:" || uriScheme == "https:" = packException HttpException http | uriScheme == "udp:" = packException UdpException udp - | otherwise = throwIO $ UnrecognizedProtocol uriScheme + | otherwise = throwIO $ UnrecognizedScheme uriScheme announce :: Manager -> URI -> SAnnounceQuery -> IO AnnounceInfo announce Manager {..} uri simpleQuery diff --git a/tests/Network/BitTorrent/Tracker/RPCSpec.hs b/tests/Network/BitTorrent/Tracker/RPCSpec.hs index b816a9ce..dfc13a1e 100644 --- a/tests/Network/BitTorrent/Tracker/RPCSpec.hs +++ b/tests/Network/BitTorrent/Tracker/RPCSpec.hs @@ -24,9 +24,9 @@ rpcOpts = def { optUdpRPC = UDP.rpcOpts } -isUnrecognizedProtocol :: String -> RpcException -> Bool -isUnrecognizedProtocol x (UnrecognizedProtocol scheme) = x == scheme -isUnrecognizedProtocol _ _ = False +matchUnrecognizedScheme :: String -> RpcException -> Bool +matchUnrecognizedScheme x (UnrecognizedScheme scheme) = x == scheme +matchUnrecognizedScheme _ _ = False spec :: Spec spec = parallel $ do @@ -46,13 +46,13 @@ spec = parallel $ do withManager rpcOpts def $ \ mgr -> do q <- arbitrarySample announce mgr "magnet://foo.bar" q - `shouldThrow` isUnrecognizedProtocol "magnet:" + `shouldThrow` matchUnrecognizedScheme "magnet:" describe "scrape" $ do it "must fail on bad uri scheme" $ do withManager rpcOpts def $ \ mgr -> do scrape mgr "magnet://foo.bar" [] - `shouldThrow` isUnrecognizedProtocol "magnet:" + `shouldThrow` matchUnrecognizedScheme "magnet:" forM_ trackers $ \ TrackerEntry {..} -> context trackerName $ do -- cgit v1.2.3