Author: xedin
Date: Wed Oct  5 11:14:12 2011
New Revision: 1179164

URL: http://svn.apache.org/viewvc?rev=1179164&view=rev
Log:
Improved CLI exceptions
patch by satishbabu; reviewed by xedin for CASSANDRA-3312

Modified:
    cassandra/branches/cassandra-0.8/CHANGES.txt
    
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cli/CliClient.java

Modified: cassandra/branches/cassandra-0.8/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/CHANGES.txt?rev=1179164&r1=1179163&r2=1179164&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.8/CHANGES.txt Wed Oct  5 11:14:12 2011
@@ -27,7 +27,7 @@
  * Allow using number as DC name when creating keyspace in CQL (CASSANDRA-3239)
  * Force flush of system table after updating/removing a token (CASSANDRA-3243)
  * Make Pig storage handle implements LoadMetadata (CASSANDRA-2777)
-
+ * Improved CLI exceptions (CASSANDRA-3312)
 
 0.8.6
  * revert CASSANDRA-2388

Modified: 
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cli/CliClient.java
URL: 
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cli/CliClient.java?rev=1179164&r1=1179163&r2=1179164&view=diff
==============================================================================
--- 
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cli/CliClient.java
 (original)
+++ 
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cli/CliClient.java
 Wed Oct  5 11:14:12 2011
@@ -301,9 +301,7 @@ public class CliClient
         }
         catch (SchemaDisagreementException e)
         {
-               RuntimeException rtEx = new RuntimeException("schema does not 
match across nodes, (try again later).");
-            rtEx.initCause(e);
-            throw new RuntimeException();
+               throw new RuntimeException("schema does not match across nodes, 
(try again later).", e);
         }
         catch (Exception e)
         {
@@ -552,7 +550,7 @@ public class CliClient
             {
                 StringBuilder errorMessage = new StringBuilder("Unknown 
comparator '" + compareWith + "'. ");
                 errorMessage.append("Available functions: ");
-                throw new 
RuntimeException(errorMessage.append(Function.getFunctionNames()).toString());
+                throw new 
RuntimeException(errorMessage.append(Function.getFunctionNames()).toString(), 
e);
             }
         }
 
@@ -778,7 +776,7 @@ public class CliClient
             }
             catch (Exception e)
             {
-                throw new RuntimeException(e.getMessage());
+                throw new RuntimeException(e);
             }
         }
 
@@ -807,11 +805,11 @@ public class CliClient
         }
         catch (InvalidRequestException e)
         {
-            throw new RuntimeException(e.getWhy());
+            throw new RuntimeException(e);
         }
         catch (Exception e)
         {
-            throw new RuntimeException(e.getMessage());
+            throw new RuntimeException(e);
         }
     }
 
@@ -894,7 +892,7 @@ public class CliClient
             }
             catch (Exception e)
             {
-                throw new RuntimeException(e.getMessage());
+                throw new RuntimeException(e);
             }
         }
 
@@ -961,7 +959,7 @@ public class CliClient
             }
             catch (Exception e)
             {
-                throw new RuntimeException(e.getMessage());
+                throw new RuntimeException(e);
             }
         }
 
@@ -1004,11 +1002,11 @@ public class CliClient
         }
         catch (InvalidRequestException e)
         {
-            throw new RuntimeException(e.getWhy());
+            throw new RuntimeException(e);
         }
         catch (Exception e)
         {
-            throw new RuntimeException(e.getMessage(), e);
+            throw new RuntimeException(e);
         }
     }
 
@@ -1034,11 +1032,11 @@ public class CliClient
         }
         catch (InvalidRequestException e)
         {
-            throw new RuntimeException(e.getWhy());
+            throw new RuntimeException(e);
         }
         catch (Exception e)
         {
-            throw new RuntimeException(e.getMessage(), e);
+            throw new RuntimeException(e);
         }
     }
 
@@ -1065,11 +1063,11 @@ public class CliClient
         }
         catch (InvalidRequestException e)
         {
-            throw new RuntimeException(e.getWhy());
+            throw new RuntimeException(e);
         }
         catch (Exception e)
         {
-            throw new RuntimeException(e.getMessage(), e);
+            throw new RuntimeException(e);
         }
     }
 
@@ -1099,11 +1097,11 @@ public class CliClient
         }
         catch (InvalidRequestException e)
         {
-            throw new RuntimeException(e.getWhy());
+            throw new RuntimeException(e);
         }
         catch (Exception e)
         {
-            throw new RuntimeException(e.getMessage(), e);
+            throw new RuntimeException(e);
         }
     }
 
@@ -1163,7 +1161,7 @@ public class CliClient
                 }
                 catch (UnknownHostException e)
                 {
-                    throw new RuntimeException(e.getMessage());
+                    throw new RuntimeException(e);
                 }
 
                 ksDef.setStrategy_options(options);
@@ -2180,7 +2178,7 @@ public class CliClient
             }
             catch (TException e)
             {
-                throw new RuntimeException(e.getMessage(), e);
+                throw new RuntimeException(e);
             }
 
             columnDefinitions.add(columnDefinition);
@@ -2211,7 +2209,7 @@ public class CliClient
             }
             catch (IllegalArgumentException ie)
             {
-                throw new RuntimeException("IndexType '" + indexTypeAsString + 
"' is unsupported.");
+                throw new RuntimeException("IndexType '" + indexTypeAsString + 
"' is unsupported.", ie);
             }
         }
 
@@ -2240,7 +2238,7 @@ public class CliClient
         }
         catch (MarshalException e)
         {
-            throw new RuntimeException(e.toString());
+            throw new RuntimeException(e);
         }
     }
     
@@ -2355,7 +2353,7 @@ public class CliClient
                 }
                 catch (Exception e)
                 {
-                    throw new RuntimeException(e.getMessage(), e);
+                    throw new RuntimeException(e);
                 }
             }
         }
@@ -2491,7 +2489,7 @@ public class CliClient
         }
         catch (Exception e)
         {
-            throw new RuntimeException(e.getMessage());
+            throw new RuntimeException(e);
         }
     }
 
@@ -2512,7 +2510,7 @@ public class CliClient
         {
             StringBuilder errorMessage = new StringBuilder("Function '" + 
functionName + "' not found. ");
             errorMessage.append("Available functions: ");
-            throw new 
RuntimeException(errorMessage.append(Function.getFunctionNames()).toString());
+            throw new 
RuntimeException(errorMessage.append(Function.getFunctionNames()).toString(), 
e);
         }
 
         return function.getValidator();


Reply via email to