summaryrefslogtreecommitdiff
path: root/src/Network/KRPC/Message.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/KRPC/Message.hs')
-rw-r--r--src/Network/KRPC/Message.hs17
1 files changed, 0 insertions, 17 deletions
diff --git a/src/Network/KRPC/Message.hs b/src/Network/KRPC/Message.hs
index d6279f11..96945843 100644
--- a/src/Network/KRPC/Message.hs
+++ b/src/Network/KRPC/Message.hs
@@ -26,11 +26,8 @@ module Network.KRPC.Message
26 -- * Error 26 -- * Error
27 , ErrorCode (..) 27 , ErrorCode (..)
28 , KError(..) 28 , KError(..)
29 , serverError
30 , decodeError 29 , decodeError
31 , unknownMethod
32 , unknownMessage 30 , unknownMessage
33 , timeoutExpired
34 31
35 -- * Query 32 -- * Query
36 , KQuery(..) 33 , KQuery(..)
@@ -143,29 +140,15 @@ instance BEncode KError where
143 140
144instance Exception KError 141instance Exception KError
145 142
146-- | Happen when some query handler fail.
147serverError :: SomeException -> TransactionId -> KError
148serverError e = KError ServerError (BC.pack (show e))
149
150-- | Received 'queryArgs' or 'respVals' can not be decoded. 143-- | Received 'queryArgs' or 'respVals' can not be decoded.
151decodeError :: String -> TransactionId -> KError 144decodeError :: String -> TransactionId -> KError
152decodeError msg = KError ProtocolError (BC.pack msg) 145decodeError msg = KError ProtocolError (BC.pack msg)
153 146
154-- | If /remote/ node send query /this/ node doesn't know about then
155-- this error message should be sent in response.
156unknownMethod :: MethodName -> TransactionId -> KError
157unknownMethod = KError MethodUnknown
158
159-- | A remote node has send some 'KMessage' this node is unable to 147-- | A remote node has send some 'KMessage' this node is unable to
160-- decode. 148-- decode.
161unknownMessage :: String -> KError 149unknownMessage :: String -> KError
162unknownMessage msg = KError ProtocolError (BC.pack msg) unknownTransaction 150unknownMessage msg = KError ProtocolError (BC.pack msg) unknownTransaction
163 151
164-- | A /remote/ node is not responding to the /our/ request the for
165-- specified period of time.
166timeoutExpired :: TransactionId -> KError
167timeoutExpired = KError GenericError "timeout expired"
168
169{----------------------------------------------------------------------- 152{-----------------------------------------------------------------------
170-- Query messages 153-- Query messages
171-----------------------------------------------------------------------} 154-----------------------------------------------------------------------}