Repository: cassandra Updated Branches: refs/heads/trunk 593886a12 -> 69f794aca
better exception messages Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/69f794ac Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/69f794ac Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/69f794ac Branch: refs/heads/trunk Commit: 69f794aca680cff079c1419f46f04316d4262a23 Parents: 593886a Author: Dave Brosius <dbros...@mebigfatguy.com> Authored: Tue Mar 17 23:07:20 2015 -0400 Committer: Dave Brosius <dbros...@mebigfatguy.com> Committed: Tue Mar 17 23:07:20 2015 -0400 ---------------------------------------------------------------------- src/java/org/apache/cassandra/cache/CachingOptions.java | 6 +++--- src/java/org/apache/cassandra/config/CFMetaData.java | 10 +++++----- .../org/apache/cassandra/config/ColumnDefinition.java | 2 +- .../apache/cassandra/config/YamlConfigurationLoader.java | 2 +- src/java/org/apache/cassandra/cql3/Attributes.java | 6 +++--- src/java/org/apache/cassandra/db/BufferExpiringCell.java | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/69f794ac/src/java/org/apache/cassandra/cache/CachingOptions.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/cache/CachingOptions.java b/src/java/org/apache/cassandra/cache/CachingOptions.java index c2605f5..1c82f55 100644 --- a/src/java/org/apache/cassandra/cache/CachingOptions.java +++ b/src/java/org/apache/cassandra/cache/CachingOptions.java @@ -76,18 +76,18 @@ public class CachingOptions { if (!(value.equals("ALL") || value.equals("NONE"))) { - throw new ConfigurationException("'keys' can only have values 'ALL' or 'NONE'"); + throw new ConfigurationException("'keys' can only have values 'ALL' or 'NONE', but was '" + value + "'"); } } else if (entry.getKey().equals("rows_per_partition")) { if (!(value.equals("ALL") || value.equals("NONE") || StringUtils.isNumeric(value))) { - throw new ConfigurationException("'rows_per_partition' can only have values 'ALL', 'NONE' or be numeric."); + throw new ConfigurationException("'rows_per_partition' can only have values 'ALL', 'NONE' or be numeric, but was '" + value + "'."); } } else - throw new ConfigurationException("Only supported CachingOptions parameters are 'keys' and 'rows_per_partition'"); + throw new ConfigurationException("Only supported CachingOptions parameters are 'keys' and 'rows_per_partition', but was '" + entry.getKey() + "'"); } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/69f794ac/src/java/org/apache/cassandra/config/CFMetaData.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/config/CFMetaData.java b/src/java/org/apache/cassandra/config/CFMetaData.java index 138acac..d8eeaf2 100644 --- a/src/java/org/apache/cassandra/config/CFMetaData.java +++ b/src/java/org/apache/cassandra/config/CFMetaData.java @@ -112,7 +112,7 @@ public final class CFMetaData { double value = Double.parseDouble(name.substring(0, name.length() - 10)); if (value > 100 || value < 0) - throw new ConfigurationException("PERCENTILE should be between 0 and 100"); + throw new ConfigurationException("PERCENTILE should be between 0 and 100, but was " + value); return new SpeculativeRetry(RetryType.PERCENTILE, (value / 100)); } else if (name.endsWith("MS")) @@ -813,10 +813,10 @@ public final class CFMetaData cfm.cfId, cfId)); if (cfm.cfType != cfType) - throw new ConfigurationException("types do not match."); + throw new ConfigurationException(String.format("Column family types do not match (found %s; expected %s).", cfm.cfType, cfType)); if (!cfm.comparator.isCompatibleWith(comparator)) - throw new ConfigurationException("comparators do not match or are not compatible."); + throw new ConfigurationException(String.format("Column family comparators do not match or are not compatible (found %s; expected %s).", cfm.comparator.getClass().getSimpleName(), comparator.getClass().getSimpleName())); } public static void validateCompactionOptions(Class<? extends AbstractCompactionStrategy> strategyClass, Map<String, String> options) throws ConfigurationException @@ -838,7 +838,7 @@ public final class CFMetaData { if (e.getTargetException() instanceof ConfigurationException) throw (ConfigurationException) e.getTargetException(); - throw new ConfigurationException("Failed to validate compaction options"); + throw new ConfigurationException("Failed to validate compaction options: " + options); } catch (ConfigurationException e) { @@ -846,7 +846,7 @@ public final class CFMetaData } catch (Exception e) { - throw new ConfigurationException("Failed to validate compaction options"); + throw new ConfigurationException("Failed to validate compaction options: " + options); } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/69f794ac/src/java/org/apache/cassandra/config/ColumnDefinition.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/config/ColumnDefinition.java b/src/java/org/apache/cassandra/config/ColumnDefinition.java index f4480e0..b33718f 100644 --- a/src/java/org/apache/cassandra/config/ColumnDefinition.java +++ b/src/java/org/apache/cassandra/config/ColumnDefinition.java @@ -252,7 +252,7 @@ public class ColumnDefinition extends ColumnSpecification assert getIndexName() != null; if (!getIndexName().equals(def.getIndexName())) - throw new ConfigurationException("Cannot modify index name"); + throw new ConfigurationException("Cannot modify index name: " + def.getIndexName()); } return new ColumnDefinition(ksName, http://git-wip-us.apache.org/repos/asf/cassandra/blob/69f794ac/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java b/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java index 8b8d75f..98eb75e 100644 --- a/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java +++ b/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java @@ -117,7 +117,7 @@ public class YamlConfigurationLoader implements ConfigurationLoader } catch (YAMLException e) { - throw new ConfigurationException("Invalid yaml", e); + throw new ConfigurationException("Invalid yaml: " + url, e); } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/69f794ac/src/java/org/apache/cassandra/cql3/Attributes.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/cql3/Attributes.java b/src/java/org/apache/cassandra/cql3/Attributes.java index 851e1b4..0ab42a2 100644 --- a/src/java/org/apache/cassandra/cql3/Attributes.java +++ b/src/java/org/apache/cassandra/cql3/Attributes.java @@ -76,7 +76,7 @@ public class Attributes } catch (MarshalException e) { - throw new InvalidRequestException("Invalid timestamp value"); + throw new InvalidRequestException("Invalid timestamp value: " + tval); } return LongType.instance.compose(tval); @@ -97,12 +97,12 @@ public class Attributes } catch (MarshalException e) { - throw new InvalidRequestException("Invalid timestamp value"); + throw new InvalidRequestException("Invalid timestamp value: " + tval); } int ttl = Int32Type.instance.compose(tval); if (ttl < 0) - throw new InvalidRequestException("A TTL must be greater or equal to 0"); + throw new InvalidRequestException("A TTL must be greater or equal to 0, but was " + ttl); if (ttl > ExpiringCell.MAX_TTL) throw new InvalidRequestException(String.format("ttl is too large. requested (%d) maximum (%d)", ttl, ExpiringCell.MAX_TTL)); http://git-wip-us.apache.org/repos/asf/cassandra/blob/69f794ac/src/java/org/apache/cassandra/db/BufferExpiringCell.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/BufferExpiringCell.java b/src/java/org/apache/cassandra/db/BufferExpiringCell.java index 347604a..6509443 100644 --- a/src/java/org/apache/cassandra/db/BufferExpiringCell.java +++ b/src/java/org/apache/cassandra/db/BufferExpiringCell.java @@ -137,9 +137,9 @@ public class BufferExpiringCell extends BufferCell implements ExpiringCell super.validateFields(metadata); if (timeToLive <= 0) - throw new MarshalException("A column TTL should be > 0"); + throw new MarshalException("A column TTL should be > 0, but was " + timeToLive); if (localExpirationTime < 0) - throw new MarshalException("The local expiration time should not be negative"); + throw new MarshalException("The local expiration time should not be negative but was " + localExpirationTime); } @Override