cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [5/6] Finer grained exception hierarchy, and adds error codes
Date Wed, 05 Sep 2012 15:51:59 GMT
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/thrift/ThriftValidation.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/thrift/ThriftValidation.java b/src/java/org/apache/cassandra/thrift/ThriftValidation.java
index d31515e..36b3aca 100644
--- a/src/java/org/apache/cassandra/thrift/ThriftValidation.java
+++ b/src/java/org/apache/cassandra/thrift/ThriftValidation.java
@@ -51,18 +51,19 @@ public class ThriftValidation
 {
     private static final Logger logger = LoggerFactory.getLogger(ThriftValidation.class);
 
-    public static void validateKey(CFMetaData metadata, ByteBuffer key) throws InvalidRequestException
+    public static void validateKey(CFMetaData metadata, ByteBuffer key) throws org.apache.cassandra.exceptions.InvalidRequestException
     {
         if (key == null || key.remaining() == 0)
         {
-            throw new InvalidRequestException("Key may not be empty");
+            throw new org.apache.cassandra.exceptions.InvalidRequestException("Key may not be empty");
         }
 
         // check that key can be handled by FBUtilities.writeShortByteArray
         if (key.remaining() > FBUtilities.MAX_UNSIGNED_SHORT)
         {
-            throw new InvalidRequestException("Key length of " + key.remaining() +
-                                              " is longer than maximum of " + FBUtilities.MAX_UNSIGNED_SHORT);
+            throw new org.apache.cassandra.exceptions.InvalidRequestException("Key length of " + key.remaining() +
+                                                                              " is longer than maximum of " +
+                                                                              FBUtilities.MAX_UNSIGNED_SHORT);
         }
 
         try
@@ -71,7 +72,7 @@ public class ThriftValidation
         }
         catch (MarshalException e)
         {
-            throw new InvalidRequestException(e.getMessage());
+            throw new org.apache.cassandra.exceptions.InvalidRequestException(e.getMessage());
         }
     }
 
@@ -83,61 +84,33 @@ public class ThriftValidation
         }
     }
 
-    // Don't check that the table exists, validateTable or validateColumnFamily must be called beforehand.
-    public static void validateConsistencyLevel(String table, ConsistencyLevel cl, RequestType requestType) throws InvalidRequestException
-    {
-        switch (cl)
-        {
-            case ANY:
-                if (requestType == RequestType.READ)
-                    throw new InvalidRequestException("ANY ConsistencyLevel is only supported for writes");
-                break;
-            case LOCAL_QUORUM:
-                requireNetworkTopologyStrategy(table, cl);
-                break;
-            case EACH_QUORUM:
-                requireNetworkTopologyStrategy(table, cl);
-                if (requestType == RequestType.READ)
-                    throw new InvalidRequestException("EACH_QUORUM ConsistencyLevel is only supported for writes");
-                break;
-        }
-    }
-
-    private static void requireNetworkTopologyStrategy(String table, ConsistencyLevel cl) throws InvalidRequestException
-    {
-        AbstractReplicationStrategy strategy = Table.open(table).getReplicationStrategy();
-        if (!(strategy instanceof NetworkTopologyStrategy))
-            throw new InvalidRequestException(String.format("consistency level %s not compatible with replication strategy (%s)",
-                                                            cl, strategy.getClass().getName()));
-    }
-
-    public static CFMetaData validateColumnFamily(String tablename, String cfName, boolean isCommutativeOp) throws InvalidRequestException
+    public static CFMetaData validateColumnFamily(String tablename, String cfName, boolean isCommutativeOp) throws org.apache.cassandra.exceptions.InvalidRequestException
     {
         CFMetaData metadata = validateColumnFamily(tablename, cfName);
 
         if (isCommutativeOp)
         {
             if (!metadata.getDefaultValidator().isCommutative())
-                throw new InvalidRequestException("invalid operation for non commutative columnfamily " + cfName);
+                throw new org.apache.cassandra.exceptions.InvalidRequestException("invalid operation for non commutative columnfamily " + cfName);
         }
         else
         {
             if (metadata.getDefaultValidator().isCommutative())
-                throw new InvalidRequestException("invalid operation for commutative columnfamily " + cfName);
+                throw new org.apache.cassandra.exceptions.InvalidRequestException("invalid operation for commutative columnfamily " + cfName);
         }
         return metadata;
     }
 
     // To be used when the operation should be authorized whether this is a counter CF or not
-    public static CFMetaData validateColumnFamily(String tablename, String cfName) throws InvalidRequestException
+    public static CFMetaData validateColumnFamily(String tablename, String cfName) throws org.apache.cassandra.exceptions.InvalidRequestException
     {
         validateTable(tablename);
         if (cfName.isEmpty())
-            throw new InvalidRequestException("non-empty columnfamily is required");
+            throw new org.apache.cassandra.exceptions.InvalidRequestException("non-empty columnfamily is required");
 
         CFMetaData metadata = Schema.instance.getCFMetaData(tablename, cfName);
         if (metadata == null)
-            throw new InvalidRequestException("unconfigured columnfamily " + cfName);
+            throw new org.apache.cassandra.exceptions.InvalidRequestException("unconfigured columnfamily " + cfName);
 
         return metadata;
     }
@@ -145,23 +118,23 @@ public class ThriftValidation
     /**
      * validates all parts of the path to the column, including the column name
      */
-    public static void validateColumnPath(CFMetaData metadata, ColumnPath column_path) throws InvalidRequestException
+    public static void validateColumnPath(CFMetaData metadata, ColumnPath column_path) throws org.apache.cassandra.exceptions.InvalidRequestException
     {
         if (metadata.cfType == ColumnFamilyType.Standard)
         {
             if (column_path.super_column != null)
             {
-                throw new InvalidRequestException("supercolumn parameter is invalid for standard CF " + metadata.cfName);
+                throw new org.apache.cassandra.exceptions.InvalidRequestException("supercolumn parameter is invalid for standard CF " + metadata.cfName);
             }
             if (column_path.column == null)
             {
-                throw new InvalidRequestException("column parameter is not optional for standard CF " + metadata.cfName);
+                throw new org.apache.cassandra.exceptions.InvalidRequestException("column parameter is not optional for standard CF " + metadata.cfName);
             }
         }
         else
         {
             if (column_path.super_column == null)
-                throw new InvalidRequestException("supercolumn parameter is not optional for super CF " + metadata.cfName);
+                throw new org.apache.cassandra.exceptions.InvalidRequestException("supercolumn parameter is not optional for super CF " + metadata.cfName);
         }
         if (column_path.column != null)
         {
@@ -173,13 +146,13 @@ public class ThriftValidation
         }
     }
 
-    public static void validateColumnParent(CFMetaData metadata, ColumnParent column_parent) throws InvalidRequestException
+    public static void validateColumnParent(CFMetaData metadata, ColumnParent column_parent) throws org.apache.cassandra.exceptions.InvalidRequestException
     {
         if (metadata.cfType == ColumnFamilyType.Standard)
         {
             if (column_parent.super_column != null)
             {
-                throw new InvalidRequestException("columnfamily alone is required for standard CF " + metadata.cfName);
+                throw new org.apache.cassandra.exceptions.InvalidRequestException("columnfamily alone is required for standard CF " + metadata.cfName);
             }
         }
 
@@ -190,20 +163,21 @@ public class ThriftValidation
     }
 
     // column_path_or_parent is a ColumnPath for remove, where the "column" is optional even for a standard CF
-    static void validateColumnPathOrParent(CFMetaData metadata, ColumnPath column_path_or_parent) throws InvalidRequestException
+    static void validateColumnPathOrParent(CFMetaData metadata, ColumnPath column_path_or_parent) throws org.apache.cassandra.exceptions.InvalidRequestException
     {
         if (metadata.cfType == ColumnFamilyType.Standard)
         {
             if (column_path_or_parent.super_column != null)
             {
-                throw new InvalidRequestException("supercolumn may not be specified for standard CF " + metadata.cfName);
+                throw new org.apache.cassandra.exceptions.InvalidRequestException("supercolumn may not be specified for standard CF " + metadata.cfName);
             }
         }
         if (metadata.cfType == ColumnFamilyType.Super)
         {
             if (column_path_or_parent.super_column == null && column_path_or_parent.column != null)
             {
-                throw new InvalidRequestException("A column cannot be specified without specifying a super column for removal on super CF " + metadata.cfName);
+                throw new org.apache.cassandra.exceptions.InvalidRequestException("A column cannot be specified without specifying a super column for removal on super CF "
+                                                                          + metadata.cfName);
             }
         }
         if (column_path_or_parent.column != null)
@@ -220,41 +194,41 @@ public class ThriftValidation
      * Validates the column names but not the parent path or data
      */
     private static void validateColumnNames(CFMetaData metadata, ByteBuffer superColumnName, Iterable<ByteBuffer> column_names)
-            throws InvalidRequestException
+    throws org.apache.cassandra.exceptions.InvalidRequestException
     {
         if (superColumnName != null)
         {
             if (superColumnName.remaining() > IColumn.MAX_NAME_LENGTH)
-                throw new InvalidRequestException("supercolumn name length must not be greater than " + IColumn.MAX_NAME_LENGTH);
+                throw new org.apache.cassandra.exceptions.InvalidRequestException("supercolumn name length must not be greater than " + IColumn.MAX_NAME_LENGTH);
             if (superColumnName.remaining() == 0)
-                throw new InvalidRequestException("supercolumn name must not be empty");
+                throw new org.apache.cassandra.exceptions.InvalidRequestException("supercolumn name must not be empty");
             if (metadata.cfType == ColumnFamilyType.Standard)
-                throw new InvalidRequestException("supercolumn specified to ColumnFamily " + metadata.cfName + " containing normal columns");
+                throw new org.apache.cassandra.exceptions.InvalidRequestException("supercolumn specified to ColumnFamily " + metadata.cfName + " containing normal columns");
         }
         AbstractType<?> comparator = metadata.getComparatorFor(superColumnName);
         for (ByteBuffer name : column_names)
         {
             if (name.remaining() > IColumn.MAX_NAME_LENGTH)
-                throw new InvalidRequestException("column name length must not be greater than " + IColumn.MAX_NAME_LENGTH);
+                throw new org.apache.cassandra.exceptions.InvalidRequestException("column name length must not be greater than " + IColumn.MAX_NAME_LENGTH);
             if (name.remaining() == 0)
-                throw new InvalidRequestException("column name must not be empty");
+                throw new org.apache.cassandra.exceptions.InvalidRequestException("column name must not be empty");
             try
             {
                 comparator.validate(name);
             }
             catch (MarshalException e)
             {
-                throw new InvalidRequestException(e.getMessage());
+                throw new org.apache.cassandra.exceptions.InvalidRequestException(e.getMessage());
             }
         }
     }
 
-    public static void validateColumnNames(CFMetaData metadata, ColumnParent column_parent, Iterable<ByteBuffer> column_names) throws InvalidRequestException
+    public static void validateColumnNames(CFMetaData metadata, ColumnParent column_parent, Iterable<ByteBuffer> column_names) throws org.apache.cassandra.exceptions.InvalidRequestException
     {
         validateColumnNames(metadata, column_parent.super_column, column_names);
     }
 
-    public static void validateRange(CFMetaData metadata, ColumnParent column_parent, SliceRange range) throws InvalidRequestException
+    public static void validateRange(CFMetaData metadata, ColumnParent column_parent, SliceRange range) throws org.apache.cassandra.exceptions.InvalidRequestException
     {
         AbstractType<?> comparator = metadata.getComparatorFor(column_parent.super_column);
         try
@@ -264,23 +238,23 @@ public class ThriftValidation
         }
         catch (MarshalException e)
         {
-            throw new InvalidRequestException(e.getMessage());
+            throw new org.apache.cassandra.exceptions.InvalidRequestException(e.getMessage());
         }
 
         if (range.count < 0)
-            throw new InvalidRequestException("get_slice requires non-negative count");
+            throw new org.apache.cassandra.exceptions.InvalidRequestException("get_slice requires non-negative count");
 
         Comparator<ByteBuffer> orderedComparator = range.isReversed() ? comparator.reverseComparator : comparator;
         if (range.start.remaining() > 0
             && range.finish.remaining() > 0
             && orderedComparator.compare(range.start, range.finish) > 0)
         {
-            throw new InvalidRequestException("range finish must come after start in the order of traversal");
+            throw new org.apache.cassandra.exceptions.InvalidRequestException("range finish must come after start in the order of traversal");
         }
     }
 
     public static void validateColumnOrSuperColumn(CFMetaData metadata, ColumnOrSuperColumn cosc)
-            throws InvalidRequestException
+            throws org.apache.cassandra.exceptions.InvalidRequestException
     {
         boolean isCommutative = metadata.getDefaultValidator().isCommutative();
 
@@ -291,12 +265,12 @@ public class ThriftValidation
         if (cosc.counter_super_column == null) nulls++;
 
         if (nulls != 3)
-            throw new InvalidRequestException("ColumnOrSuperColumn must have one (and only one) of column, super_column, counter and counter_super_column");
+            throw new org.apache.cassandra.exceptions.InvalidRequestException("ColumnOrSuperColumn must have one (and only one) of column, super_column, counter and counter_super_column");
 
         if (cosc.column != null)
         {
             if (isCommutative)
-                throw new InvalidRequestException("invalid operation for commutative columnfamily " + metadata.cfName);
+                throw new org.apache.cassandra.exceptions.InvalidRequestException("invalid operation for commutative columnfamily " + metadata.cfName);
 
             validateTtl(cosc.column);
             validateColumnPath(metadata, new ColumnPath(metadata.cfName).setSuper_column((ByteBuffer)null).setColumn(cosc.column.name));
@@ -306,7 +280,7 @@ public class ThriftValidation
         if (cosc.super_column != null)
         {
             if (isCommutative)
-                throw new InvalidRequestException("invalid operation for commutative columnfamily " + metadata.cfName);
+                throw new org.apache.cassandra.exceptions.InvalidRequestException("invalid operation for commutative columnfamily " + metadata.cfName);
 
             for (Column c : cosc.super_column.columns)
             {
@@ -318,7 +292,7 @@ public class ThriftValidation
         if (cosc.counter_column != null)
         {
             if (!isCommutative)
-                throw new InvalidRequestException("invalid operation for non commutative columnfamily " + metadata.cfName);
+                throw new org.apache.cassandra.exceptions.InvalidRequestException("invalid operation for non commutative columnfamily " + metadata.cfName);
 
             validateColumnPath(metadata, new ColumnPath(metadata.cfName).setSuper_column((ByteBuffer)null).setColumn(cosc.counter_column.name));
         }
@@ -326,25 +300,25 @@ public class ThriftValidation
         if (cosc.counter_super_column != null)
         {
             if (!isCommutative)
-                throw new InvalidRequestException("invalid operation for non commutative columnfamily " + metadata.cfName);
+                throw new org.apache.cassandra.exceptions.InvalidRequestException("invalid operation for non commutative columnfamily " + metadata.cfName);
 
             for (CounterColumn c : cosc.counter_super_column.columns)
                 validateColumnPath(metadata, new ColumnPath(metadata.cfName).setSuper_column(cosc.counter_super_column.name).setColumn(c.name));
         }
     }
 
-    private static void validateTtl(Column column) throws InvalidRequestException
+    private static void validateTtl(Column column) throws org.apache.cassandra.exceptions.InvalidRequestException
     {
         if (column.isSetTtl() && column.ttl <= 0)
         {
-            throw new InvalidRequestException("ttl must be positive");
+            throw new org.apache.cassandra.exceptions.InvalidRequestException("ttl must be positive");
         }
         // if it's not set, then it should be zero -- here we are just checking to make sure Thrift doesn't change that contract with us.
         assert column.isSetTtl() || column.ttl == 0;
     }
 
     public static void validateMutation(CFMetaData metadata, Mutation mut)
-            throws InvalidRequestException
+            throws org.apache.cassandra.exceptions.InvalidRequestException
     {
         ColumnOrSuperColumn cosc = mut.column_or_supercolumn;
         Deletion del = mut.deletion;
@@ -355,7 +329,7 @@ public class ThriftValidation
 
         if (nulls != 1)
         {
-            throw new InvalidRequestException("mutation must have one and only one of column_or_supercolumn or deletion");
+            throw new org.apache.cassandra.exceptions.InvalidRequestException("mutation must have one and only one of column_or_supercolumn or deletion");
         }
 
         if (cosc != null)
@@ -368,7 +342,7 @@ public class ThriftValidation
         }
     }
 
-    public static void validateDeletion(CFMetaData metadata, Deletion del) throws InvalidRequestException
+    public static void validateDeletion(CFMetaData metadata, Deletion del) throws org.apache.cassandra.exceptions.InvalidRequestException
     {
 
         if (del.super_column != null)
@@ -378,13 +352,13 @@ public class ThriftValidation
         {
             validateSlicePredicate(metadata, del.super_column, del.predicate);
             if (del.predicate.slice_range != null)
-                throw new InvalidRequestException("Deletion does not yet support SliceRange predicates.");
+                throw new org.apache.cassandra.exceptions.InvalidRequestException("Deletion does not yet support SliceRange predicates.");
         }
 
         if (metadata.cfType == ColumnFamilyType.Standard && del.super_column != null)
         {
             String msg = String.format("Deletion of super columns is not possible on a standard ColumnFamily (KeySpace=%s ColumnFamily=%s Deletion=%s)", metadata.ksName, metadata.cfName, del);
-            throw new InvalidRequestException(msg);
+            throw new org.apache.cassandra.exceptions.InvalidRequestException(msg);
         }
 
         if (metadata.getDefaultValidator().isCommutative())
@@ -394,14 +368,14 @@ public class ThriftValidation
         }
         else if (!del.isSetTimestamp())
         {
-            throw new InvalidRequestException("Deletion timestamp is not optional for non commutative column family " + metadata.cfName);
+            throw new org.apache.cassandra.exceptions.InvalidRequestException("Deletion timestamp is not optional for non commutative column family " + metadata.cfName);
         }
     }
 
-    public static void validateSlicePredicate(CFMetaData metadata, ByteBuffer scName, SlicePredicate predicate) throws InvalidRequestException
+    public static void validateSlicePredicate(CFMetaData metadata, ByteBuffer scName, SlicePredicate predicate) throws org.apache.cassandra.exceptions.InvalidRequestException
     {
         if (predicate.column_names == null && predicate.slice_range == null)
-            throw new InvalidRequestException("A SlicePredicate must be given a list of Columns, a SliceRange, or both");
+            throw new org.apache.cassandra.exceptions.InvalidRequestException("A SlicePredicate must be given a list of Columns, a SliceRange, or both");
 
         if (predicate.slice_range != null)
             validateRange(metadata, new ColumnParent(metadata.cfName).setSuper_column(scName), predicate.slice_range);
@@ -413,13 +387,13 @@ public class ThriftValidation
     /**
      * Validates the data part of the column (everything in the Column object but the name, which is assumed to be valid)
      */
-    public static void validateColumnData(CFMetaData metadata, Column column, boolean isSubColumn) throws InvalidRequestException
+    public static void validateColumnData(CFMetaData metadata, Column column, boolean isSubColumn) throws org.apache.cassandra.exceptions.InvalidRequestException
     {
         validateTtl(column);
         if (!column.isSetValue())
-            throw new InvalidRequestException("Column value is required");
+            throw new org.apache.cassandra.exceptions.InvalidRequestException("Column value is required");
         if (!column.isSetTimestamp())
-            throw new InvalidRequestException("Column timestamp is required");
+            throw new org.apache.cassandra.exceptions.InvalidRequestException("Column timestamp is required");
 
         ColumnDefinition columnDef = metadata.getColumnDefinition(column.name);
         try
@@ -432,20 +406,20 @@ public class ThriftValidation
         {
             if (logger.isDebugEnabled())
                 logger.debug("rejecting invalid value " + ByteBufferUtil.bytesToHex(summarize(column.value)));
-            throw new InvalidRequestException(String.format("(%s) [%s][%s][%s] failed validation",
-                                                            me.getMessage(),
-                                                            metadata.ksName,
-                                                            metadata.cfName,
-                                                            (isSubColumn ? metadata.subcolumnComparator : metadata.comparator).getString(column.name)));
+            throw new org.apache.cassandra.exceptions.InvalidRequestException(String.format("(%s) [%s][%s][%s] failed validation",
+                                                                      me.getMessage(),
+                                                                      metadata.ksName,
+                                                                      metadata.cfName,
+                                                                      (isSubColumn ? metadata.subcolumnComparator : metadata.comparator).getString(column.name)));
         }
 
         // Indexed column values cannot be larger than 64K.  See CASSANDRA-3057/4240 for more details       
         if (!Table.open(metadata.ksName).getColumnFamilyStore(metadata.cfName).indexManager.validate(column))
-                    throw new InvalidRequestException(String.format("Can't index column value of size %d for index %s in CF %s of KS %s",
-                                                                     column.value.remaining(),
-                                                                     columnDef.getIndexName(),
-                                                                     metadata.cfName,
-                                                                     metadata.ksName));
+                    throw new org.apache.cassandra.exceptions.InvalidRequestException(String.format("Can't index column value of size %d for index %s in CF %s of KS %s",
+                                                                              column.value.remaining(),
+                                                                              columnDef.getIndexName(),
+                                                                              metadata.cfName,
+                                                                              metadata.ksName));
     }
 
     /**
@@ -462,12 +436,12 @@ public class ThriftValidation
 
 
     public static void validatePredicate(CFMetaData metadata, ColumnParent column_parent, SlicePredicate predicate)
-            throws InvalidRequestException
+            throws org.apache.cassandra.exceptions.InvalidRequestException
     {
         if (predicate.column_names == null && predicate.slice_range == null)
-            throw new InvalidRequestException("predicate column_names and slice_range may not both be null");
+            throw new org.apache.cassandra.exceptions.InvalidRequestException("predicate column_names and slice_range may not both be null");
         if (predicate.column_names != null && predicate.slice_range != null)
-            throw new InvalidRequestException("predicate column_names and slice_range may not both be present");
+            throw new org.apache.cassandra.exceptions.InvalidRequestException("predicate column_names and slice_range may not both be present");
 
         if (predicate.getSlice_range() != null)
             validateRange(metadata, column_parent, predicate.slice_range);
@@ -475,17 +449,17 @@ public class ThriftValidation
             validateColumnNames(metadata, column_parent, predicate.column_names);
     }
 
-    public static void validateKeyRange(CFMetaData metadata, ByteBuffer superColumn, KeyRange range) throws InvalidRequestException
+    public static void validateKeyRange(CFMetaData metadata, ByteBuffer superColumn, KeyRange range) throws org.apache.cassandra.exceptions.InvalidRequestException
     {
         if ((range.start_key == null) == (range.start_token == null)
             || (range.end_key == null) == (range.end_token == null))
         {
-            throw new InvalidRequestException("exactly one of {start key, end key} or {start token, end token} must be specified");
+            throw new org.apache.cassandra.exceptions.InvalidRequestException("exactly one of {start key, end key} or {start token, end token} must be specified");
         }
 
         // (key, token) is supported (for wide-row CFRR) but not (token, key)
         if (range.start_token != null && range.end_key != null)
-            throw new InvalidRequestException("start token + end key is not a supported key range");
+            throw new org.apache.cassandra.exceptions.InvalidRequestException("start token + end key is not a supported key range");
 
         if (range.start_key != null && range.end_key != null)
         {
@@ -495,9 +469,9 @@ public class ThriftValidation
             if (startToken.compareTo(endToken) > 0 && !endToken.isMinimum(p))
             {
                 if (p instanceof RandomPartitioner)
-                    throw new InvalidRequestException("start key's md5 sorts after end key's md5.  this is not allowed; you probably should not specify end key at all, under RandomPartitioner");
+                    throw new org.apache.cassandra.exceptions.InvalidRequestException("start key's md5 sorts after end key's md5.  this is not allowed; you probably should not specify end key at all, under RandomPartitioner");
                 else
-                    throw new InvalidRequestException("start key must sort before (or equal to) finish key in your partitioner!");
+                    throw new org.apache.cassandra.exceptions.InvalidRequestException("start key must sort before (or equal to) finish key in your partitioner!");
             }
         }
 
@@ -505,12 +479,12 @@ public class ThriftValidation
 
         if (!isEmpty(range.row_filter) && superColumn != null)
         {
-            throw new InvalidRequestException("super columns are not supported for indexing");
+            throw new org.apache.cassandra.exceptions.InvalidRequestException("super columns are not supported for indexing");
         }
 
         if (range.count <= 0)
         {
-            throw new InvalidRequestException("maxRows must be positive");
+            throw new org.apache.cassandra.exceptions.InvalidRequestException("maxRows must be positive");
         }
     }
 
@@ -520,18 +494,18 @@ public class ThriftValidation
     }
 
     public static void validateIndexClauses(CFMetaData metadata, IndexClause index_clause)
-    throws InvalidRequestException
+    throws org.apache.cassandra.exceptions.InvalidRequestException
     {
         if (index_clause.expressions.isEmpty())
-            throw new InvalidRequestException("index clause list may not be empty");
+            throw new org.apache.cassandra.exceptions.InvalidRequestException("index clause list may not be empty");
 
         if (!validateFilterClauses(metadata, index_clause.expressions))
-            throw new InvalidRequestException("No indexed columns present in index clause with operator EQ");
+            throw new org.apache.cassandra.exceptions.InvalidRequestException("No indexed columns present in index clause with operator EQ");
     }
 
     // return true if index_clause contains an indexed columns with operator EQ
     public static boolean validateFilterClauses(CFMetaData metadata, List<IndexExpression> index_clause)
-    throws InvalidRequestException
+    throws org.apache.cassandra.exceptions.InvalidRequestException
     {
         if (isEmpty(index_clause))
             // no filter to apply
@@ -549,14 +523,14 @@ public class ThriftValidation
             }
             catch (MarshalException me)
             {
-                throw new InvalidRequestException(String.format("[%s]=[%s] failed name validation (%s)",
-                                                                ByteBufferUtil.bytesToHex(expression.column_name),
-                                                                ByteBufferUtil.bytesToHex(expression.value),
-                                                                me.getMessage()));
+                throw new org.apache.cassandra.exceptions.InvalidRequestException(String.format("[%s]=[%s] failed name validation (%s)",
+                                                                                  ByteBufferUtil.bytesToHex(expression.column_name),
+                                                                                  ByteBufferUtil.bytesToHex(expression.value),
+                                                                                  me.getMessage()));
             }
 
             if (expression.value.remaining() > 0xFFFF)
-                throw new InvalidRequestException("Index expression values may not be larger than 64K");
+                throw new org.apache.cassandra.exceptions.InvalidRequestException("Index expression values may not be larger than 64K");
 
             AbstractType<?> valueValidator = Schema.instance.getValueValidator(metadata.ksName, metadata.cfName, expression.column_name);
             try
@@ -565,10 +539,10 @@ public class ThriftValidation
             }
             catch (MarshalException me)
             {
-                throw new InvalidRequestException(String.format("[%s]=[%s] failed value validation (%s)",
-                                                                ByteBufferUtil.bytesToHex(expression.column_name),
-                                                                ByteBufferUtil.bytesToHex(expression.value),
-                                                                me.getMessage()));
+                throw new org.apache.cassandra.exceptions.InvalidRequestException(String.format("[%s]=[%s] failed value validation (%s)",
+                                                                                  ByteBufferUtil.bytesToHex(expression.column_name),
+                                                                                  ByteBufferUtil.bytesToHex(expression.value),
+                                                                                  me.getMessage()));
             }
 
             isIndexed |= (expression.op == IndexOperator.EQ) && idxManager.indexes(expression.column_name);
@@ -577,19 +551,7 @@ public class ThriftValidation
         return isIndexed;
     }
 
-    public static void validateCommutativeForWrite(CFMetaData metadata, ConsistencyLevel consistency) throws InvalidRequestException
-    {
-        if (consistency == ConsistencyLevel.ANY)
-        {
-            throw new InvalidRequestException("Consistency level ANY is not yet supported for counter columnfamily " + metadata.cfName);
-        }
-        else if (!metadata.getReplicateOnWrite() && consistency != ConsistencyLevel.ONE)
-        {
-            throw new InvalidRequestException("cannot achieve CL > CL.ONE without replicate_on_write on columnfamily " + metadata.cfName);
-        }
-    }
-
-    public static void validateKeyspaceNotYetExisting(String newKsName) throws InvalidRequestException
+    public static void validateKeyspaceNotYetExisting(String newKsName) throws org.apache.cassandra.exceptions.InvalidRequestException
     {
         // keyspace names must be unique case-insensitively because the keyspace name becomes the directory
         // where we store CF sstables.  Names that differ only in case would thus cause problems on
@@ -597,16 +559,16 @@ public class ThriftValidation
         for (String ksName : Schema.instance.getTables())
         {
             if (ksName.equalsIgnoreCase(newKsName))
-                throw new InvalidRequestException(String.format("Keyspace names must be case-insensitively unique (\"%s\" conflicts with \"%s\")",
-                                                                newKsName,
-                                                                ksName));
+                throw new org.apache.cassandra.exceptions.InvalidRequestException(String.format("Keyspace names must be case-insensitively unique (\"%s\" conflicts with \"%s\")",
+                                                                                  newKsName,
+                                                                                  ksName));
         }
     }
 
-    public static void validateKeyspaceNotSystem(String modifiedKeyspace) throws InvalidRequestException
+    public static void validateKeyspaceNotSystem(String modifiedKeyspace) throws org.apache.cassandra.exceptions.InvalidRequestException
     {
         if (modifiedKeyspace.equalsIgnoreCase(Table.SYSTEM_KS))
-            throw new InvalidRequestException("system keyspace is not user-modifiable");
+            throw new org.apache.cassandra.exceptions.InvalidRequestException("system keyspace is not user-modifiable");
     }
 
     public static IFilter asIFilter(SlicePredicate sp, AbstractType<?> comparator)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/tools/NodeCmd.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/NodeCmd.java b/src/java/org/apache/cassandra/tools/NodeCmd.java
index 409716a..3f3a62a 100644
--- a/src/java/org/apache/cassandra/tools/NodeCmd.java
+++ b/src/java/org/apache/cassandra/tools/NodeCmd.java
@@ -34,7 +34,8 @@ import com.google.common.collect.Maps;
 import org.apache.commons.cli.*;
 
 import org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutorMBean;
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
+import org.apache.cassandra.exceptions.InvalidRequestException;
 import org.apache.cassandra.db.ColumnFamilyStoreMBean;
 import org.apache.cassandra.db.Table;
 import org.apache.cassandra.db.compaction.CompactionManagerMBean;
@@ -43,7 +44,6 @@ import org.apache.cassandra.locator.EndpointSnitchInfoMBean;
 import org.apache.cassandra.net.MessagingServiceMBean;
 import org.apache.cassandra.service.CacheServiceMBean;
 import org.apache.cassandra.service.StorageProxyMBean;
-import org.apache.cassandra.thrift.InvalidRequestException;
 import org.apache.cassandra.utils.EstimatedHistogram;
 import org.apache.cassandra.utils.Pair;
 
@@ -1182,7 +1182,7 @@ public class NodeCmd
         }
         catch (InvalidRequestException e)
         {
-            err(e, e.getWhy());
+            err(e, e.getMessage());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/tools/NodeProbe.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/NodeProbe.java b/src/java/org/apache/cassandra/tools/NodeProbe.java
index c3db63c..814e6d1 100644
--- a/src/java/org/apache/cassandra/tools/NodeProbe.java
+++ b/src/java/org/apache/cassandra/tools/NodeProbe.java
@@ -37,7 +37,7 @@ import javax.management.remote.JMXServiceURL;
 import com.google.common.collect.Iterables;
 
 import org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutorMBean;
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.*;
 import org.apache.cassandra.db.ColumnFamilyStoreMBean;
 import org.apache.cassandra.db.compaction.CompactionManager;
 import org.apache.cassandra.db.compaction.CompactionManagerMBean;
@@ -49,8 +49,6 @@ import org.apache.cassandra.net.MessagingServiceMBean;
 import org.apache.cassandra.service.*;
 import org.apache.cassandra.streaming.StreamingService;
 import org.apache.cassandra.streaming.StreamingServiceMBean;
-import org.apache.cassandra.thrift.InvalidRequestException;
-import org.apache.cassandra.thrift.UnavailableException;
 
 /**
  * JMX client operations for Cassandra.

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/tools/SSTableExport.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/SSTableExport.java b/src/java/org/apache/cassandra/tools/SSTableExport.java
index 7017232..260331d 100644
--- a/src/java/org/apache/cassandra/tools/SSTableExport.java
+++ b/src/java/org/apache/cassandra/tools/SSTableExport.java
@@ -40,7 +40,7 @@ import org.apache.commons.cli.ParseException;
 import org.apache.commons.cli.PosixParser;
 
 import org.apache.cassandra.config.CFMetaData;
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.config.Schema;
 import org.apache.cassandra.db.AbstractColumnContainer;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/tools/SSTableImport.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/SSTableImport.java b/src/java/org/apache/cassandra/tools/SSTableImport.java
index 0b11617..74a86ca 100644
--- a/src/java/org/apache/cassandra/tools/SSTableImport.java
+++ b/src/java/org/apache/cassandra/tools/SSTableImport.java
@@ -35,7 +35,7 @@ import org.apache.commons.cli.ParseException;
 import org.apache.commons.cli.PosixParser;
 
 import org.apache.cassandra.config.CFMetaData;
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.config.Schema;
 import org.apache.cassandra.db.AbstractColumnContainer;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/tools/SSTableMetadataViewer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/SSTableMetadataViewer.java b/src/java/org/apache/cassandra/tools/SSTableMetadataViewer.java
index 626fb6e..c1f0332 100644
--- a/src/java/org/apache/cassandra/tools/SSTableMetadataViewer.java
+++ b/src/java/org/apache/cassandra/tools/SSTableMetadataViewer.java
@@ -20,7 +20,7 @@ package org.apache.cassandra.tools;
 import java.io.IOException;
 import java.io.PrintStream;
 
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.io.sstable.Descriptor;
 import org.apache.cassandra.io.sstable.SSTableMetadata;
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/tracing/Tracing.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tracing/Tracing.java b/src/java/org/apache/cassandra/tracing/Tracing.java
index 7675d74..98a0cd4 100644
--- a/src/java/org/apache/cassandra/tracing/Tracing.java
+++ b/src/java/org/apache/cassandra/tracing/Tracing.java
@@ -34,6 +34,7 @@ import org.apache.cassandra.concurrent.StageManager;
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.cql3.ColumnNameBuilder;
 import org.apache.cassandra.db.ColumnFamily;
+import org.apache.cassandra.db.ConsistencyLevel;
 import org.apache.cassandra.db.ExpiringColumn;
 import org.apache.cassandra.db.RowMutation;
 import org.apache.cassandra.db.marshal.InetAddressType;
@@ -42,9 +43,6 @@ import org.apache.cassandra.db.marshal.TimeUUIDType;
 import org.apache.cassandra.db.marshal.UTF8Type;
 import org.apache.cassandra.net.MessageIn;
 import org.apache.cassandra.service.StorageProxy;
-import org.apache.cassandra.thrift.ConsistencyLevel;
-import org.apache.cassandra.thrift.TimedOutException;
-import org.apache.cassandra.thrift.UnavailableException;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.utils.UUIDGen;
@@ -177,7 +175,7 @@ public class Tracing
 
             StageManager.getStage(Stage.TRACING).execute(new WrappedRunnable()
             {
-                public void runMayThrow() throws TimedOutException, UnavailableException
+                public void runMayThrow() throws Exception
                 {
                     ColumnFamily cf = ColumnFamily.create(CFMetaData.TraceSessionsCf);
                     addColumn(cf,
@@ -212,7 +210,7 @@ public class Tracing
 
         StageManager.getStage(Stage.TRACING).execute(new WrappedRunnable()
         {
-            public void runMayThrow() throws TimedOutException, UnavailableException
+            public void runMayThrow() throws Exception
             {
                 ColumnFamily cf = ColumnFamily.create(CFMetaData.TraceSessionsCf);
                 addColumn(cf,

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/tracing/TracingAppender.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tracing/TracingAppender.java b/src/java/org/apache/cassandra/tracing/TracingAppender.java
index 3643adf..e0dcd07 100644
--- a/src/java/org/apache/cassandra/tracing/TracingAppender.java
+++ b/src/java/org/apache/cassandra/tracing/TracingAppender.java
@@ -10,11 +10,9 @@ import org.apache.cassandra.concurrent.Stage;
 import org.apache.cassandra.concurrent.StageManager;
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.db.ColumnFamily;
+import org.apache.cassandra.db.ConsistencyLevel;
 import org.apache.cassandra.db.RowMutation;
 import org.apache.cassandra.service.StorageProxy;
-import org.apache.cassandra.thrift.ConsistencyLevel;
-import org.apache.cassandra.thrift.TimedOutException;
-import org.apache.cassandra.thrift.UnavailableException;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.utils.UUIDGen;
@@ -37,7 +35,7 @@ public class TracingAppender extends AppenderSkeleton
         final String threadName = event.getThreadName();
         StageManager.getStage(Stage.TRACING).execute(new WrappedRunnable()
         {
-            public void runMayThrow() throws TimedOutException, UnavailableException
+            public void runMayThrow() throws Exception
             {
                 ByteBuffer eventId = ByteBufferUtil.bytes(UUIDGen.makeType1UUIDFromHost(FBUtilities
                         .getBroadcastAddress()));

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/transport/DataType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/transport/DataType.java b/src/java/org/apache/cassandra/transport/DataType.java
index 9a8c2f0..29d7a93 100644
--- a/src/java/org/apache/cassandra/transport/DataType.java
+++ b/src/java/org/apache/cassandra/transport/DataType.java
@@ -26,7 +26,7 @@ import java.util.List;
 import com.google.common.base.Charsets;
 import org.jboss.netty.buffer.ChannelBuffer;
 
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.RequestValidationException;
 import org.apache.cassandra.db.marshal.*;
 import org.apache.cassandra.utils.Pair;
 
@@ -188,7 +188,7 @@ public enum DataType implements OptionCodec.Codecable<DataType>
                     return entry.left.type;
             }
         }
-        catch (ConfigurationException e)
+        catch (RequestValidationException e)
         {
             throw new ProtocolException(e.getMessage());
         }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/transport/ProtocolException.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/transport/ProtocolException.java b/src/java/org/apache/cassandra/transport/ProtocolException.java
index 15112e1..fd62581 100644
--- a/src/java/org/apache/cassandra/transport/ProtocolException.java
+++ b/src/java/org/apache/cassandra/transport/ProtocolException.java
@@ -17,13 +17,23 @@
  */
 package org.apache.cassandra.transport;
 
+import java.nio.ByteBuffer;
+
+import org.apache.cassandra.exceptions.ExceptionCode;
+import org.apache.cassandra.exceptions.TransportException;
+
 /**
- * Exceptions thrown when a client didn't not respect the protocol.
+ * Exceptions thrown when a client didn't respect the protocol.
  */
-public class ProtocolException extends RuntimeException
+public class ProtocolException extends RuntimeException implements TransportException
 {
     public ProtocolException(String msg)
     {
         super(msg);
     }
+
+    public ExceptionCode code()
+    {
+        return ExceptionCode.PROTOCOL_ERROR;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/transport/ServerError.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/transport/ServerError.java b/src/java/org/apache/cassandra/transport/ServerError.java
new file mode 100644
index 0000000..55d5177
--- /dev/null
+++ b/src/java/org/apache/cassandra/transport/ServerError.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cassandra.transport;
+
+import java.nio.ByteBuffer;
+
+import org.apache.cassandra.exceptions.ExceptionCode;
+import org.apache.cassandra.exceptions.TransportException;
+
+/**
+ * Exceptions thrown when a client didn't respect the protocol.
+ */
+public class ServerError extends RuntimeException implements TransportException
+{
+    public ServerError(Throwable e)
+    {
+        super(e.toString());
+    }
+
+    public ServerError(String msg)
+    {
+        super(msg);
+    }
+
+    public ExceptionCode code()
+    {
+        return ExceptionCode.SERVER_ERROR;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/transport/SimpleClient.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/transport/SimpleClient.java b/src/java/org/apache/cassandra/transport/SimpleClient.java
index bca39ea..9e0ea2e 100644
--- a/src/java/org/apache/cassandra/transport/SimpleClient.java
+++ b/src/java/org/apache/cassandra/transport/SimpleClient.java
@@ -154,7 +154,7 @@ public class SimpleClient
             lastWriteFuture = channel.write(request);
             Message.Response msg = responseHandler.responses.take();
             if (msg instanceof ErrorMessage)
-                throw new RuntimeException(((ErrorMessage)msg).errorMsg);
+                throw new RuntimeException((Throwable)((ErrorMessage)msg).error);
             return msg;
         }
         catch (InterruptedException e)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/transport/messages/ErrorMessage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/transport/messages/ErrorMessage.java b/src/java/org/apache/cassandra/transport/messages/ErrorMessage.java
index 7204f97..c21e727 100644
--- a/src/java/org/apache/cassandra/transport/messages/ErrorMessage.java
+++ b/src/java/org/apache/cassandra/transport/messages/ErrorMessage.java
@@ -17,77 +17,161 @@
  */
 package org.apache.cassandra.transport.messages;
 
+import java.nio.ByteBuffer;
 import java.util.concurrent.TimeoutException;
 
 import org.jboss.netty.buffer.ChannelBuffer;
 import org.jboss.netty.buffer.ChannelBuffers;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
+import org.apache.cassandra.db.ConsistencyLevel;
+import org.apache.cassandra.exceptions.*;
 import org.apache.cassandra.transport.CBUtil;
 import org.apache.cassandra.transport.Message;
 import org.apache.cassandra.transport.ProtocolException;
+import org.apache.cassandra.transport.ServerError;
 import org.apache.cassandra.thrift.AuthenticationException;
-import org.apache.cassandra.thrift.InvalidRequestException;
-import org.apache.cassandra.thrift.TimedOutException;
-import org.apache.cassandra.thrift.UnavailableException;
+import org.apache.cassandra.utils.ByteBufferUtil;
 
 /**
  * Message to indicate an error to the client.
- *
- * Error codes are:
- *   0x0000: Server error
- *   0x0001: Protocol error
- *   0x0002: Authentication error
- *   0x0100: Unavailable exception
- *   0x0101: Timeout exception
- *   0x0200: Request exception
  */
 public class ErrorMessage extends Message.Response
 {
+    private static final Logger logger = LoggerFactory.getLogger(ErrorMessage.class);
+
     public static final Message.Codec<ErrorMessage> codec = new Message.Codec<ErrorMessage>()
     {
         public ErrorMessage decode(ChannelBuffer body)
         {
-            int code = body.readInt();
+            ExceptionCode code = ExceptionCode.fromValue(body.readInt());
             String msg = CBUtil.readString(body);
-            return new ErrorMessage(code, msg);
+
+            TransportException te = null;
+            switch (code)
+            {
+                case SERVER_ERROR:
+                    te = new ServerError(msg);
+                    break;
+                case PROTOCOL_ERROR:
+                    te = new ProtocolException(msg);
+                    break;
+                case UNAVAILABLE:
+                    {
+                        ConsistencyLevel cl = Enum.valueOf(ConsistencyLevel.class, CBUtil.readString(body));
+                        int required = body.readInt();
+                        int alive = body.readInt();
+                        te = new UnavailableException(cl, required, alive);
+                    }
+                    break;
+                case OVERLOADED:
+                    te = new OverloadedException(msg);
+                    break;
+                case IS_BOOTSTRAPPING:
+                    te = new IsBootstrappingException();
+                    break;
+                case TRUNCATE_ERROR:
+                    te = new TruncateException(msg);
+                    break;
+                case WRITE_TIMEOUT:
+                    {
+                        ConsistencyLevel cl = Enum.valueOf(ConsistencyLevel.class, CBUtil.readString(body));
+                        int received = body.readInt();
+                        int blockFor = body.readInt();
+                        te = new WriteTimeoutException(cl, received, blockFor);
+                    }
+                    break;
+                case READ_TIMEOUT:
+                    {
+                        ConsistencyLevel cl = Enum.valueOf(ConsistencyLevel.class, CBUtil.readString(body));
+                        int received = body.readInt();
+                        int blockFor = body.readInt();
+                        byte dataPresent = body.readByte();
+                        te = new ReadTimeoutException(cl, received, blockFor, dataPresent != 0);
+                    }
+                    break;
+                case SYNTAX_ERROR:
+                    te = new SyntaxException(msg);
+                    break;
+                case UNAUTHORIZED:
+                    te = new UnauthorizedException(msg);
+                    break;
+                case INVALID:
+                    te = new InvalidRequestException(msg);
+                    break;
+                case CONFIG_ERROR:
+                    te = new ConfigurationException(msg);
+                    break;
+                case ALREADY_EXISTS:
+                    String ksName = CBUtil.readString(body);
+                    String cfName = CBUtil.readString(body);
+                    te = new AlreadyExistsException(ksName, cfName);
+                    break;
+            }
+            return new ErrorMessage(te);
         }
 
         public ChannelBuffer encode(ErrorMessage msg)
         {
-            ChannelBuffer ccb = CBUtil.intToCB(msg.code);
-            ChannelBuffer mcb = CBUtil.stringToCB(msg.errorMsg);
-            return ChannelBuffers.wrappedBuffer(ccb, mcb);
+            ChannelBuffer ccb = CBUtil.intToCB(msg.error.code().value);
+            ChannelBuffer mcb = CBUtil.stringToCB(msg.error.getMessage());
+
+            ChannelBuffer acb = ChannelBuffers.EMPTY_BUFFER;
+            switch (msg.error.code())
+            {
+                case UNAVAILABLE:
+                    UnavailableException ue = (UnavailableException)msg.error;
+                    ByteBuffer ueCl = ByteBufferUtil.bytes(ue.consistency.toString());
+
+                    acb = ChannelBuffers.buffer(2 + ueCl.remaining() + 8);
+                    acb.writeShort((short)ueCl.remaining());
+                    acb.writeBytes(ueCl);
+                    acb.writeInt(ue.required);
+                    acb.writeInt(ue.alive);
+                    break;
+                case WRITE_TIMEOUT:
+                case READ_TIMEOUT:
+                    RequestTimeoutException rte = (RequestTimeoutException)msg.error;
+                    ReadTimeoutException readEx = rte instanceof ReadTimeoutException
+                                                ? (ReadTimeoutException)rte
+                                                : null;
+                    ByteBuffer rteCl = ByteBufferUtil.bytes(rte.consistency.toString());
+                    acb = ChannelBuffers.buffer(2 + rteCl.remaining() + 8 + (readEx == null ? 0 : 1));
+                    acb.writeShort((short)rteCl.remaining());
+                    acb.writeBytes(rteCl);
+                    acb.writeInt(rte.received);
+                    acb.writeInt(rte.blockFor);
+                    if (readEx != null)
+                        acb.writeByte((byte)(readEx.dataPresent ? 1 : 0));
+                    break;
+                case ALREADY_EXISTS:
+                    AlreadyExistsException aee = (AlreadyExistsException)msg.error;
+                    acb = ChannelBuffers.wrappedBuffer(CBUtil.stringToCB(aee.ksName),
+                                                       CBUtil.stringToCB(aee.cfName));
+                    break;
+            }
+            return ChannelBuffers.wrappedBuffer(ccb, mcb, acb);
         }
     };
 
     // We need to figure error codes out (#3979)
-    public final int code;
-    public final String errorMsg;
+    public final TransportException error;
 
-    public ErrorMessage(int code, String errorMsg)
+    private ErrorMessage(TransportException error)
     {
         super(Message.Type.ERROR);
-        this.code = code;
-        this.errorMsg = errorMsg;
+        this.error = error;
     }
 
-    public static ErrorMessage fromException(Throwable t)
+    public static ErrorMessage fromException(Throwable e)
     {
-        String msg = t.getMessage() == null ? t.toString() : t.getMessage();
-
-        if (t instanceof TimeoutException || t instanceof TimedOutException)
-            return new ErrorMessage(0x0101, msg);
-        else if (t instanceof UnavailableException)
-            return new ErrorMessage(0x0100, msg);
-        else if (t instanceof InvalidRequestException)
-            return new ErrorMessage(0x0200, msg);
-        else if (t instanceof ProtocolException)
-            return new ErrorMessage(0x0001, msg);
-        else if (t instanceof AuthenticationException)
-            return new ErrorMessage(0x0002, msg);
+        if (e instanceof TransportException)
+            return new ErrorMessage((TransportException)e);
 
-        logger.error("Unknown exception during request", t);
-        return new ErrorMessage(0x0000, msg);
+        // Unexpected exception
+        logger.debug("Unexpected exception during request", e);
+        return new ErrorMessage(new ServerError(e));
     }
 
     public ChannelBuffer encode()
@@ -98,6 +182,6 @@ public class ErrorMessage extends Message.Response
     @Override
     public String toString()
     {
-        return "ERROR " + code + ": " + errorMsg;
+        return "ERROR " + error.code() + ": " + error.getMessage();
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java b/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
index e93b58c..9d2d0e4 100644
--- a/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
+++ b/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
@@ -25,8 +25,8 @@ import org.jboss.netty.buffer.ChannelBuffer;
 
 import org.apache.cassandra.cql3.CQLStatement;
 import org.apache.cassandra.cql3.QueryProcessor;
+import org.apache.cassandra.exceptions.InvalidRequestException;
 import org.apache.cassandra.transport.*;
-import org.apache.cassandra.thrift.InvalidRequestException;
 
 public class ExecuteMessage extends Message.Request
 {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/transport/messages/QueryMessage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/transport/messages/QueryMessage.java b/src/java/org/apache/cassandra/transport/messages/QueryMessage.java
index 2aefcb8..399fe95 100644
--- a/src/java/org/apache/cassandra/transport/messages/QueryMessage.java
+++ b/src/java/org/apache/cassandra/transport/messages/QueryMessage.java
@@ -20,10 +20,10 @@ package org.apache.cassandra.transport.messages;
 import org.jboss.netty.buffer.ChannelBuffer;
 
 import org.apache.cassandra.cql3.QueryProcessor;
+import org.apache.cassandra.exceptions.InvalidRequestException;
+import org.apache.cassandra.exceptions.RequestTimeoutException;
+import org.apache.cassandra.exceptions.UnavailableException;
 import org.apache.cassandra.transport.*;
-import org.apache.cassandra.thrift.InvalidRequestException;
-import org.apache.cassandra.thrift.TimedOutException;
-import org.apache.cassandra.thrift.UnavailableException;
 
 /**
  * A CQL query
@@ -67,7 +67,7 @@ public class QueryMessage extends Message.Request
         {
             if (!((e instanceof UnavailableException)
                || (e instanceof InvalidRequestException)
-               || (e instanceof TimedOutException)))
+               || (e instanceof RequestTimeoutException)))
             {
                 logger.error("Unexpected error during query", e);
             }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/transport/messages/StartupMessage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/transport/messages/StartupMessage.java b/src/java/org/apache/cassandra/transport/messages/StartupMessage.java
index a8fe43b..fc28b69 100644
--- a/src/java/org/apache/cassandra/transport/messages/StartupMessage.java
+++ b/src/java/org/apache/cassandra/transport/messages/StartupMessage.java
@@ -24,8 +24,8 @@ import org.jboss.netty.buffer.ChannelBuffer;
 import org.jboss.netty.buffer.ChannelBuffers;
 
 import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.exceptions.InvalidRequestException;
 import org.apache.cassandra.transport.*;
-import org.apache.cassandra.thrift.InvalidRequestException;
 import org.apache.cassandra.utils.SemanticVersion;
 
 /**
@@ -133,12 +133,12 @@ public class StartupMessage extends Message.Request
                 if (compression.equals("snappy"))
                 {
                     if (FrameCompressor.SnappyCompressor.instance == null)
-                        throw new InvalidRequestException("This instance does not support Snappy compression");
+                        throw new ProtocolException("This instance does not support Snappy compression");
                     connection.setCompressor(FrameCompressor.SnappyCompressor.instance);
                 }
                 else
                 {
-                    throw new InvalidRequestException(String.format("Unknown compression algorithm: %s", compression));
+                    throw new ProtocolException(String.format("Unknown compression algorithm: %s", compression));
                 }
             }
 
@@ -149,7 +149,7 @@ public class StartupMessage extends Message.Request
         }
         catch (InvalidRequestException e)
         {
-            return ErrorMessage.fromException(e);
+            return ErrorMessage.fromException(new ProtocolException(e.getMessage()));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/utils/FBUtilities.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/FBUtilities.java b/src/java/org/apache/cassandra/utils/FBUtilities.java
index fcfdd2b..c7c7356 100644
--- a/src/java/org/apache/cassandra/utils/FBUtilities.java
+++ b/src/java/org/apache/cassandra/utils/FBUtilities.java
@@ -41,7 +41,7 @@ import org.slf4j.LoggerFactory;
 
 import org.apache.cassandra.cache.IRowCacheProvider;
 import org.apache.cassandra.concurrent.CreationTimeAwareFuture;
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.db.DecoratedKey;
 import org.apache.cassandra.dht.IPartitioner;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/long/org/apache/cassandra/db/MeteredFlusherTest.java
----------------------------------------------------------------------
diff --git a/test/long/org/apache/cassandra/db/MeteredFlusherTest.java b/test/long/org/apache/cassandra/db/MeteredFlusherTest.java
index ba2d2fd..e2a6973 100644
--- a/test/long/org/apache/cassandra/db/MeteredFlusherTest.java
+++ b/test/long/org/apache/cassandra/db/MeteredFlusherTest.java
@@ -28,7 +28,7 @@ import org.junit.Test;
 
 import org.apache.cassandra.SchemaLoader;
 import org.apache.cassandra.config.CFMetaData;
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.db.marshal.UTF8Type;
 import org.apache.cassandra.service.MigrationManager;
 import org.apache.cassandra.utils.ByteBufferUtil;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/SchemaLoader.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/SchemaLoader.java b/test/unit/org/apache/cassandra/SchemaLoader.java
index 5189835..2197b2b 100644
--- a/test/unit/org/apache/cassandra/SchemaLoader.java
+++ b/test/unit/org/apache/cassandra/SchemaLoader.java
@@ -36,6 +36,7 @@ import org.apache.cassandra.db.compaction.LeveledCompactionStrategy;
 import org.apache.cassandra.db.filter.QueryPath;
 import org.apache.cassandra.db.index.composites.CompositesIndex;
 import org.apache.cassandra.db.marshal.*;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.gms.Gossiper;
 import org.apache.cassandra.io.compress.CompressionParameters;
 import org.apache.cassandra.io.compress.SnappyCompressor;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/cli/CliTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cli/CliTest.java b/test/unit/org/apache/cassandra/cli/CliTest.java
index c13cf01..989e400 100644
--- a/test/unit/org/apache/cassandra/cli/CliTest.java
+++ b/test/unit/org/apache/cassandra/cli/CliTest.java
@@ -19,7 +19,7 @@
 package org.apache.cassandra.cli;
 
 import org.apache.cassandra.SchemaLoader;
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.config.Schema;
 import org.apache.cassandra.service.EmbeddedCassandraService;
 import org.apache.cassandra.thrift.*;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java b/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java
index 99fc58d..4273662 100644
--- a/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java
+++ b/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java
@@ -19,10 +19,11 @@
 package org.apache.cassandra.config;
 
 import org.apache.cassandra.SchemaLoader;
+import org.apache.cassandra.exceptions.ConfigurationException;
+import org.apache.cassandra.exceptions.InvalidRequestException;
 import org.apache.cassandra.gms.Gossiper;
 import org.apache.cassandra.locator.SimpleStrategy;
 import org.apache.cassandra.service.MigrationManager;
-import org.apache.cassandra.thrift.InvalidRequestException;
 
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/config/DefsTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/config/DefsTest.java b/test/unit/org/apache/cassandra/config/DefsTest.java
index b01ffc4..5bb16a0 100644
--- a/test/unit/org/apache/cassandra/config/DefsTest.java
+++ b/test/unit/org/apache/cassandra/config/DefsTest.java
@@ -32,6 +32,7 @@ import org.apache.cassandra.db.filter.QueryPath;
 import org.apache.cassandra.db.marshal.BytesType;
 import org.apache.cassandra.db.marshal.UTF8Type;
 import org.apache.cassandra.db.marshal.TimeUUIDType;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.io.sstable.Component;
 import org.apache.cassandra.io.sstable.Descriptor;
 import org.apache.cassandra.io.sstable.SSTableDeletingTask;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/db/CleanupTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/CleanupTest.java b/test/unit/org/apache/cassandra/db/CleanupTest.java
index ec74ae3..85eb70b 100644
--- a/test/unit/org/apache/cassandra/db/CleanupTest.java
+++ b/test/unit/org/apache/cassandra/db/CleanupTest.java
@@ -29,7 +29,7 @@ import java.util.concurrent.ExecutionException;
 
 import org.apache.cassandra.SchemaLoader;
 import org.apache.cassandra.Util;
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.db.columniterator.IdentityQueryFilter;
 import org.apache.cassandra.db.compaction.CompactionManager;
 import org.apache.cassandra.db.filter.IFilter;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
index 090aad3..f8dafc4 100644
--- a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
+++ b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
@@ -56,7 +56,7 @@ import static org.apache.commons.lang.ArrayUtils.EMPTY_BYTE_ARRAY;
 import org.apache.cassandra.SchemaLoader;
 import org.apache.cassandra.Util;
 import org.apache.cassandra.config.ColumnDefinition;
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.db.columniterator.IdentityQueryFilter;
 import org.apache.cassandra.db.filter.*;
 import org.apache.cassandra.db.index.SecondaryIndex;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/db/ScrubTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/ScrubTest.java b/test/unit/org/apache/cassandra/db/ScrubTest.java
index 871723e..fbde908 100644
--- a/test/unit/org/apache/cassandra/db/ScrubTest.java
+++ b/test/unit/org/apache/cassandra/db/ScrubTest.java
@@ -30,7 +30,7 @@ import org.junit.Test;
 
 import org.apache.cassandra.SchemaLoader;
 import org.apache.cassandra.Util;
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.db.columniterator.IdentityQueryFilter;
 import org.apache.cassandra.db.compaction.CompactionManager;
 import org.apache.cassandra.io.util.FileUtils;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/db/SecondaryIndexColumnSizeTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/SecondaryIndexColumnSizeTest.java b/test/unit/org/apache/cassandra/db/SecondaryIndexColumnSizeTest.java
index 00bd779..e1cce4e 100644
--- a/test/unit/org/apache/cassandra/db/SecondaryIndexColumnSizeTest.java
+++ b/test/unit/org/apache/cassandra/db/SecondaryIndexColumnSizeTest.java
@@ -25,7 +25,7 @@ import java.util.SortedSet;
 
 import org.junit.Test;
 
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.db.index.PerColumnSecondaryIndex;
 import org.apache.cassandra.db.index.PerRowSecondaryIndex;
 import org.apache.cassandra.db.index.SecondaryIndexSearcher;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/db/marshal/CompositeTypeTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/marshal/CompositeTypeTest.java b/test/unit/org/apache/cassandra/db/marshal/CompositeTypeTest.java
index 1bc3d70..dd07d84 100644
--- a/test/unit/org/apache/cassandra/db/marshal/CompositeTypeTest.java
+++ b/test/unit/org/apache/cassandra/db/marshal/CompositeTypeTest.java
@@ -29,7 +29,8 @@ import static org.junit.Assert.fail;
 
 import org.apache.cassandra.SchemaLoader;
 import org.apache.cassandra.Util;
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
+import org.apache.cassandra.exceptions.SyntaxException;
 import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.filter.QueryFilter;
 import org.apache.cassandra.db.filter.QueryPath;
@@ -200,6 +201,7 @@ public class CompositeTypeTest extends SchemaLoader
             fail("Shouldn't work");
         }
         catch (ConfigurationException e) {}
+        catch (SyntaxException e) {}
 
         try
         {
@@ -207,6 +209,7 @@ public class CompositeTypeTest extends SchemaLoader
             fail("Shouldn't work");
         }
         catch (ConfigurationException e) {}
+        catch (SyntaxException e) {}
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/db/marshal/TypeParserTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/marshal/TypeParserTest.java b/test/unit/org/apache/cassandra/db/marshal/TypeParserTest.java
index dc7037a..ee3052c 100644
--- a/test/unit/org/apache/cassandra/db/marshal/TypeParserTest.java
+++ b/test/unit/org/apache/cassandra/db/marshal/TypeParserTest.java
@@ -21,12 +21,13 @@ package org.apache.cassandra.db.marshal;
 import org.junit.Test;
 import static org.junit.Assert.fail;
 
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
+import org.apache.cassandra.exceptions.SyntaxException;
 
 public class TypeParserTest
 {
     @Test
-    public void testParse() throws ConfigurationException
+    public void testParse() throws ConfigurationException, SyntaxException
     {
         AbstractType type;
 
@@ -61,7 +62,7 @@ public class TypeParserTest
     }
 
     @Test
-    public void testParseError() throws ConfigurationException
+    public void testParseError()
     {
         try
         {
@@ -69,6 +70,7 @@ public class TypeParserTest
             fail("Should not pass");
         }
         catch (ConfigurationException e) {}
+        catch (SyntaxException e) {}
 
         try
         {
@@ -76,5 +78,6 @@ public class TypeParserTest
             fail("Should not pass");
         }
         catch (ConfigurationException e) {}
+        catch (SyntaxException e) {}
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/locator/DynamicEndpointSnitchTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/locator/DynamicEndpointSnitchTest.java b/test/unit/org/apache/cassandra/locator/DynamicEndpointSnitchTest.java
index 21a7993..298f1c7 100644
--- a/test/unit/org/apache/cassandra/locator/DynamicEndpointSnitchTest.java
+++ b/test/unit/org/apache/cassandra/locator/DynamicEndpointSnitchTest.java
@@ -23,7 +23,7 @@ import java.io.IOException;
 import java.net.InetAddress;
 import java.util.ArrayList;
 
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.service.StorageService;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/locator/EC2SnitchTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/locator/EC2SnitchTest.java b/test/unit/org/apache/cassandra/locator/EC2SnitchTest.java
index 103db51..db79a73 100644
--- a/test/unit/org/apache/cassandra/locator/EC2SnitchTest.java
+++ b/test/unit/org/apache/cassandra/locator/EC2SnitchTest.java
@@ -27,7 +27,7 @@ import java.io.IOException;
 import java.net.InetAddress;
 import java.util.Map;
 
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.gms.ApplicationState;
 import org.apache.cassandra.gms.Gossiper;
 import org.apache.cassandra.gms.VersionedValue;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/locator/NetworkTopologyStrategyTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/locator/NetworkTopologyStrategyTest.java b/test/unit/org/apache/cassandra/locator/NetworkTopologyStrategyTest.java
index a120f20..6de0b09 100644
--- a/test/unit/org/apache/cassandra/locator/NetworkTopologyStrategyTest.java
+++ b/test/unit/org/apache/cassandra/locator/NetworkTopologyStrategyTest.java
@@ -35,7 +35,7 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.dht.StringToken;
 import org.apache.cassandra.dht.Token;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java b/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java
index 33dc4cc..bbb382b 100644
--- a/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java
+++ b/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java
@@ -28,7 +28,7 @@ import org.apache.commons.lang.StringUtils;
 import org.junit.Test;
 
 import org.apache.cassandra.SchemaLoader;
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.dht.BigIntegerToken;
 import org.apache.cassandra.dht.Token;
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java b/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java
index 8c17f6d..5f108ee 100644
--- a/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java
+++ b/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java
@@ -30,7 +30,7 @@ import org.apache.cassandra.config.Schema;
 import org.junit.Test;
 
 import org.apache.cassandra.SchemaLoader;
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.config.KSMetaData;
 import org.apache.cassandra.db.Table;
 import org.apache.cassandra.dht.*;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/service/AntiEntropyServiceCounterTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/service/AntiEntropyServiceCounterTest.java b/test/unit/org/apache/cassandra/service/AntiEntropyServiceCounterTest.java
index af876fc..ec0dffc 100644
--- a/test/unit/org/apache/cassandra/service/AntiEntropyServiceCounterTest.java
+++ b/test/unit/org/apache/cassandra/service/AntiEntropyServiceCounterTest.java
@@ -26,7 +26,7 @@ import java.util.LinkedList;
 import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.filter.QueryPath;
 import org.apache.cassandra.utils.ByteBufferUtil;
-import org.apache.cassandra.thrift.ConsistencyLevel;
+import org.apache.cassandra.db.ConsistencyLevel;
 
 public class AntiEntropyServiceCounterTest extends AntiEntropyServiceTestAbstract
 {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/service/EmbeddedCassandraServiceTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/service/EmbeddedCassandraServiceTest.java b/test/unit/org/apache/cassandra/service/EmbeddedCassandraServiceTest.java
index 332f95a..a70c7c0 100644
--- a/test/unit/org/apache/cassandra/service/EmbeddedCassandraServiceTest.java
+++ b/test/unit/org/apache/cassandra/service/EmbeddedCassandraServiceTest.java
@@ -26,7 +26,7 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 
 import org.apache.cassandra.SchemaLoader;
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.config.Schema;
 import org.apache.cassandra.thrift.*;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/service/InitClientTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/service/InitClientTest.java b/test/unit/org/apache/cassandra/service/InitClientTest.java
index a248ca7..7d44cd8 100644
--- a/test/unit/org/apache/cassandra/service/InitClientTest.java
+++ b/test/unit/org/apache/cassandra/service/InitClientTest.java
@@ -4,7 +4,7 @@ import org.junit.Test;
 
 import java.io.IOException;
 
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 
 /**
  * Licensed to the Apache Software Foundation (ASF) under one

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java b/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java
index 7e2130c..73abbe2 100644
--- a/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java
+++ b/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java
@@ -24,7 +24,7 @@ import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.*;
 
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.config.Schema;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/service/MoveTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/service/MoveTest.java b/test/unit/org/apache/cassandra/service/MoveTest.java
index ce7864c..65d934b 100644
--- a/test/unit/org/apache/cassandra/service/MoveTest.java
+++ b/test/unit/org/apache/cassandra/service/MoveTest.java
@@ -33,7 +33,7 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.config.Schema;
 import org.apache.cassandra.SchemaLoader;
 import org.apache.cassandra.Util;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/service/RemoveTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/service/RemoveTest.java b/test/unit/org/apache/cassandra/service/RemoveTest.java
index 58ae797..4e21a7b 100644
--- a/test/unit/org/apache/cassandra/service/RemoveTest.java
+++ b/test/unit/org/apache/cassandra/service/RemoveTest.java
@@ -35,7 +35,7 @@ import org.junit.Test;
 
 import org.apache.cassandra.SchemaLoader;
 import org.apache.cassandra.Util;
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.dht.IPartitioner;
 import org.apache.cassandra.dht.RandomPartitioner;
 import org.apache.cassandra.dht.Token;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/service/StorageServiceClientTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/service/StorageServiceClientTest.java b/test/unit/org/apache/cassandra/service/StorageServiceClientTest.java
index e0dca35..19efe3a 100644
--- a/test/unit/org/apache/cassandra/service/StorageServiceClientTest.java
+++ b/test/unit/org/apache/cassandra/service/StorageServiceClientTest.java
@@ -20,7 +20,7 @@
 package org.apache.cassandra.service;
 
 import org.apache.cassandra.SchemaLoader;
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.junit.Test;
 import static org.junit.Assert.assertFalse;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java b/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java
index e43124d..c4931a6 100644
--- a/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java
+++ b/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java
@@ -26,7 +26,7 @@ import java.util.List;
 
 import org.junit.Test;
 
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.db.Table;
 import org.apache.cassandra.dht.Token;
 import org.apache.cassandra.SchemaLoader;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/test/unit/org/apache/cassandra/thrift/ThriftValidationTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/thrift/ThriftValidationTest.java b/test/unit/org/apache/cassandra/thrift/ThriftValidationTest.java
index 41b432e..45ab748 100644
--- a/test/unit/org/apache/cassandra/thrift/ThriftValidationTest.java
+++ b/test/unit/org/apache/cassandra/thrift/ThriftValidationTest.java
@@ -28,20 +28,21 @@ import org.apache.cassandra.SchemaLoader;
 import org.apache.cassandra.config.*;
 import org.apache.cassandra.db.marshal.AsciiType;
 import org.apache.cassandra.db.marshal.UTF8Type;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.locator.LocalStrategy;
 import org.apache.cassandra.locator.NetworkTopologyStrategy;
 import org.apache.cassandra.utils.ByteBufferUtil;
 
 public class ThriftValidationTest extends SchemaLoader
 {
-    @Test(expected=InvalidRequestException.class)
-    public void testValidateCommutativeWithStandard() throws InvalidRequestException
+    @Test(expected=org.apache.cassandra.exceptions.InvalidRequestException.class)
+    public void testValidateCommutativeWithStandard() throws org.apache.cassandra.exceptions.InvalidRequestException
     {
         ThriftValidation.validateColumnFamily("Keyspace1", "Standard1", true);
     }
 
     @Test
-    public void testValidateCommutativeWithCounter() throws InvalidRequestException
+    public void testValidateCommutativeWithCounter() throws org.apache.cassandra.exceptions.InvalidRequestException
     {
         ThriftValidation.validateColumnFamily("Keyspace1", "Counter1", true);
     }


Mime
View raw message