[
https://issues.apache.org/jira/browse/AVRO-1480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13932240#comment-13932240
]
Doug Cutting commented on AVRO-1480:
------------------------------------
Adding a subclass (AvroFieldNotFound or somesuch) seems better, if folks want
to specially process this exception.
> AvroTypeException should include fieldName as distinct field
> ------------------------------------------------------------
>
> Key: AVRO-1480
> URL: https://issues.apache.org/jira/browse/AVRO-1480
> Project: Avro
> Issue Type: Improvement
> Components: java
> Affects Versions: 1.7.6
> Reporter: Will Sargent
> Priority: Minor
>
> Currently AvroTypeException is defined as
> public class AvroTypeException extends AvroRuntimeException {
> public AvroTypeException(String message) { super(message); }
> public AvroTypeException(String message, Throwable cause) {
> super(message, cause);
> }
> }
> And when used in JSONDecoder, field name failures are defined like this:
> throw new AvroTypeException("Expected field name not found: " + fa.fname);
> This means that, in the event of an AvroTypeException, the only way to find
> which field has the error is to scan through the error message.
> If the AvroTypeException had a constructor (message, throwable, field) or a
> subclass which explicitly provided fields, then it would make error
> processing much easier.
--
This message was sent by Atlassian JIRA
(v6.2#6252)