[YANGTOOLS-763] yang-data-codecs: improve validation error reporting Created: 22/Mar/17 Updated: 10/Apr/22 Resolved: 16/Apr/20 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 5.0.0 |
| Type: | Improvement | ||
| Reporter: | Robert Varga | Assignee: | Tadey Bilan |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: All |
||
| Issue Links: |
|
||||||||
| Description |
|
Our current codecs throw a generic IllegalArgumentException when data passes parsing but fails validation (such as pattern, length or range constraints). This results in loss of information in schema, as these constraints can carry additional information. Introduce a specialized subclass of IllegalArgumentException which will contain:
Once defined, make all codec instances throw this exception instead of IAE when validation fails. |
| Comments |
| Comment by Robert Varga [ 22/Mar/17 ] |
|
This exception should be hosted in yang.data.api.codec and all codecs which can be constrained with a ConstraintMetaDefinition relevant during deserialization should have their deserialize() method documented (in javadoc) to throw this exception. |