Skip to content
Snippets Groups Projects
Commit 60443f61 authored by Agata Murawska's avatar Agata Murawska
Browse files

Rename RpcError -> String function


As per Iustin's suggestion, show is not a good solution - so instead
the name is now explainRpcError.

Signed-off-by: default avatarAgata Murawska <agatamurawska@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 6e3bf290
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,7 @@ module Ganeti.Rpc ...@@ -31,6 +31,7 @@ module Ganeti.Rpc
, Rpc , Rpc
, RpcError(..) , RpcError(..)
, ERpcError , ERpcError
, explainRpcError
, executeRpcCall , executeRpcCall
, rpcCallName , rpcCallName
...@@ -104,18 +105,19 @@ data RpcError ...@@ -104,18 +105,19 @@ data RpcError
| JsonDecodeError String | JsonDecodeError String
| RpcResultError String | RpcResultError String
| OfflineNodeError Node | OfflineNodeError Node
deriving Eq deriving (Show, Eq)
instance Show RpcError where -- | Provide explanation to RPC errors.
show CurlDisabledError = explainRpcError :: RpcError -> String
explainRpcError CurlDisabledError =
"RPC/curl backend disabled at compile time" "RPC/curl backend disabled at compile time"
show (CurlLayerError node code) = explainRpcError (CurlLayerError node code) =
"Curl error for " ++ nodeName node ++ ", " ++ code "Curl error for " ++ nodeName node ++ ", " ++ code
show (JsonDecodeError msg) = explainRpcError (JsonDecodeError msg) =
"Error while decoding JSON from HTTP response: " ++ msg "Error while decoding JSON from HTTP response: " ++ msg
show (RpcResultError msg) = explainRpcError (RpcResultError msg) =
"Error reponse received from RPC server: " ++ msg "Error reponse received from RPC server: " ++ msg
show (OfflineNodeError node) = explainRpcError (OfflineNodeError node) =
"Node " ++ nodeName node ++ " is marked as offline" "Node " ++ nodeName node ++ " is marked as offline"
type ERpcError = Either RpcError type ERpcError = Either RpcError
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment