static void EnsureNotError(JsonRpcResponse response)
        {
            if (response.Error == null)
                return;

            var realException = response.Error.Data as string;
            throw new JsonRpcException(response.Error.Message, realException);
        }
 void SendResponse(JsonWriter writer, JsonRpcResponse response)
 {
     Log.Info(response.Error != null ? "Sending error response" : "Sending successful response");
     try
     {
         serializer.Serialize(writer, response);
     }
     catch (Exception ex)
     {
         Log.Error("Unable to send response: " + ex.Message);
     }
 }