s7 / scale7-pelops

A Java library for accessing the Cassandra database
New discussion group: http://groups.google.com/group/scale7
118 stars 28 forks source link

Validation errors are difficult to debug #49

Open toddfast opened 12 years ago

toddfast commented 12 years ago

It's difficult to debug issues where null data is being passed into Pelops because Pelops' validation error messages don't include sufficient information. For example, in the Validation class, error messages should include column names, values, row numbers, and whatever else is known, in easily-consumable form (i.e. as strings, not byte arrays).

danwashusen commented 12 years ago

Agreed that its annoying but unfortunately the Column class doesn't provide any type info and the name attribute is a byte[]. Maybe we could try and query the schema to see if we can get some extra info out but it would be a pain...

toddfast commented 12 years ago

Thanks for the response. How about caching some type information in the Bytes class that you can then use to reconstruct something human-readable? Or perhaps just cache the original value (should be easy for the immutable types at least)? Even if not, assuming the buffer represents a string would go a long way.

eryabitskiy commented 12 years ago

What about writing logs/exceptions in 2 variants? 1) bytes/hex that we have now 2) Configurable interpretation, that by default is String UTF-8

In 95% cases column names are UTF-8 strings, and in 50% column values are utf-8 Strings, even serialized objects usually have utf-8 encoded string values that can be visualized in this case.

And if some one need specific interpretation for column names/values we can add some way to overwrite default utf-8 interpretation.