diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-06 05:59:50 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-06 05:59:50 +0400 |
commit | 9af46d4e657bce0a343c7ca0dfacad6696bbf503 (patch) | |
tree | 823f682ae27edfe27aa90ada8df56e2cb734ed5b /src/Network/BitTorrent/Tracker | |
parent | 285a01b62a2cf42d3548a0af6235f7ae2e3d1603 (diff) |
Add generic tracker RPC exception
Diffstat (limited to 'src/Network/BitTorrent/Tracker')
-rw-r--r-- | src/Network/BitTorrent/Tracker/RPC.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Network/BitTorrent/Tracker/RPC.hs b/src/Network/BitTorrent/Tracker/RPC.hs index 48048964..0ffb2017 100644 --- a/src/Network/BitTorrent/Tracker/RPC.hs +++ b/src/Network/BitTorrent/Tracker/RPC.hs | |||
@@ -122,9 +122,10 @@ withManager opts info = bracket (newManager opts info) closeManager | |||
122 | -- TODO Catch IO exceptions on rpc calls (?) | 122 | -- TODO Catch IO exceptions on rpc calls (?) |
123 | 123 | ||
124 | data RpcException | 124 | data RpcException |
125 | = UdpException UDP.RpcException -- ^ | 125 | = UdpException UDP.RpcException -- ^ UDP RPC driver failure; |
126 | | HttpException HTTP.RpcException -- ^ | 126 | | HttpException HTTP.RpcException -- ^ HTTP RPC driver failure; |
127 | | UnknownProtocol String -- ^ unknown tracker protocol scheme | 127 | | UnrecognizedProtocol String -- ^ unsupported scheme in announce URI; |
128 | | GenericException String -- ^ for furter extensibility. | ||
128 | deriving (Show, Typeable) | 129 | deriving (Show, Typeable) |
129 | 130 | ||
130 | instance Exception RpcException | 131 | instance Exception RpcException |
@@ -141,7 +142,7 @@ dispatch :: URI -> IO a -> IO a -> IO a | |||
141 | dispatch URI {..} http udp | 142 | dispatch URI {..} http udp |
142 | | uriScheme == "http:" = packException HttpException http | 143 | | uriScheme == "http:" = packException HttpException http |
143 | | uriScheme == "udp:" = packException UdpException udp | 144 | | uriScheme == "udp:" = packException UdpException udp |
144 | | otherwise = throwIO $ UnknownProtocol uriScheme | 145 | | otherwise = throwIO $ UnrecognizedProtocol uriScheme |
145 | 146 | ||
146 | announce :: Manager -> URI -> SAnnounceQuery -> IO AnnounceInfo | 147 | announce :: Manager -> URI -> SAnnounceQuery -> IO AnnounceInfo |
147 | announce Manager {..} uri simpleQuery | 148 | announce Manager {..} uri simpleQuery |