From 60443f6143c30aff6577d95512f58b0e7d65d71c Mon Sep 17 00:00:00 2001
From: Agata Murawska <agatamurawska@google.com>
Date: Thu, 27 Sep 2012 10:56:36 +0200
Subject: [PATCH] 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: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 htools/Ganeti/Rpc.hs | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/htools/Ganeti/Rpc.hs b/htools/Ganeti/Rpc.hs
index e1f539682..c3d2c73ae 100644
--- a/htools/Ganeti/Rpc.hs
+++ b/htools/Ganeti/Rpc.hs
@@ -31,6 +31,7 @@ module Ganeti.Rpc
   , Rpc
   , RpcError(..)
   , ERpcError
+  , explainRpcError
   , executeRpcCall
 
   , rpcCallName
@@ -104,18 +105,19 @@ data RpcError
   | JsonDecodeError String
   | RpcResultError String
   | OfflineNodeError Node
-  deriving Eq
+  deriving (Show, Eq)
 
-instance Show RpcError where
-  show CurlDisabledError =
+-- | Provide explanation to RPC errors.
+explainRpcError :: RpcError -> String
+explainRpcError CurlDisabledError =
     "RPC/curl backend disabled at compile time"
-  show (CurlLayerError node code) =
+explainRpcError (CurlLayerError node code) =
     "Curl error for " ++ nodeName node ++ ", " ++ code
-  show (JsonDecodeError msg) =
+explainRpcError (JsonDecodeError msg) =
     "Error while decoding JSON from HTTP response: " ++ msg
-  show (RpcResultError msg) =
+explainRpcError (RpcResultError msg) =
     "Error reponse received from RPC server: " ++ msg
-  show (OfflineNodeError node) =
+explainRpcError (OfflineNodeError node) =
     "Node " ++ nodeName node ++ " is marked as offline"
 
 type ERpcError = Either RpcError
-- 
GitLab