super-csv / super-csv

A fast, programmer-friendly, free CSV library for Java
http://super-csv.github.io/super-csv
Apache License 2.0
527 stars 140 forks source link

Support for custom validation/error message for cell-processors? #67

Closed pkalwar closed 8 years ago

pkalwar commented 9 years ago

Is it possible to have a custom error msg attached to a cell-processor, so when it fails validation, we get our custom msg in the exception?

I had opened a stackOverflow Q also: http://stackoverflow.com/questions/32075090/custom-error-message-for-a-cell-processor-in-supercsv

pkalwar commented 9 years ago

Ok, "Hound Dog" had replied.

yes, this could have been done with custom cell-processor, but overriding 5-6 type of processors (for now, but who knows later), just for a custom message seems overkill, where as the cell-processor constructor could accept a msg instead, and be kept in the base processor, or so.

Localized message problem could also be solved to some extent: while creating cell-processors, code would know the user's locale, and read the resource bundles itself and set appropriate msg into the processor - done..

kbilsted commented 9 years ago

I don't see the sanity in infering the locale of files based on the current locale. However, it may be a nice idea with configuration-based exception messages. You are welcome to send a PR with the necesarry changes.

ZioberMichal commented 9 years ago

Generally, the idea with internationalizing does not sound bad but I do not see bigger benefits of it. The one reason which I see when I need internationalizing it is propagating exception message to user interface. Does it your case, @pkalwar ?

Of course, PR is always welcomed.

kbilsted commented 9 years ago

@pkalwar are you interested in supplying a PR or can we close this issue?

pkalwar commented 8 years ago

@kbilsted i have deferred the idea of having custom msg for now. But if i badly need it later, i'll see to implement it. Thanks.

kbilsted commented 8 years ago

closing. If any one have strong feelings towards doing this please re-open.