diff options
Diffstat (limited to 'src/Network/KRPC/Message.hs')
-rw-r--r-- | src/Network/KRPC/Message.hs | 17 |
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 | ||
144 | instance Exception KError | 141 | instance Exception KError |
145 | 142 | ||
146 | -- | Happen when some query handler fail. | ||
147 | serverError :: SomeException -> TransactionId -> KError | ||
148 | serverError 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. |
151 | decodeError :: String -> TransactionId -> KError | 144 | decodeError :: String -> TransactionId -> KError |
152 | decodeError msg = KError ProtocolError (BC.pack msg) | 145 | decodeError 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. | ||
156 | unknownMethod :: MethodName -> TransactionId -> KError | ||
157 | unknownMethod = 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. |
161 | unknownMessage :: String -> KError | 149 | unknownMessage :: String -> KError |
162 | unknownMessage msg = KError ProtocolError (BC.pack msg) unknownTransaction | 150 | unknownMessage 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. | ||
166 | timeoutExpired :: TransactionId -> KError | ||
167 | timeoutExpired = KError GenericError "timeout expired" | ||
168 | |||
169 | {----------------------------------------------------------------------- | 152 | {----------------------------------------------------------------------- |
170 | -- Query messages | 153 | -- Query messages |
171 | -----------------------------------------------------------------------} | 154 | -----------------------------------------------------------------------} |