[YANGTOOLS-538] Yang parser exceptions should follow consistent path Created: 27/Oct/15 Updated: 10/Apr/22 Resolved: 16/Jan/16 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | ||
| Reporter: | Tom Pantelis | Assignee: | Igor Foltin |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: All |
||
| External issue ID: | 4540 |
| Description |
|
The build methods in BuildGlobalContext declare SourceException and ReactorException to be thrown and it seems the intention is for completePhaseAction to assemble all SourceException errors into a single checked ReactorException. However, there are several (maybe many) yang syntax violations that cause unchecked exceptions to be thrown, eg IllegalStateException and IllegalArgumentException. If you specify an invalid type, eg "string1": typedef revision-identifier { } you'll see an IllegalStateException thrown. If you specify an invalid yang statement like "grouping1" instead of "grouping", you'll see an IllegalArgumentException. The code should be consistent and only propagate errors via the declared checked exceptions. |
| Comments |
| Comment by Tony Tkacik [ 28/Oct/15 ] |
|
Changed to Change Request, since it proposes changing of implementation. Actually there are three types of base exceptions which should be thrown / generated during parsing (subclassing them to more specific seems fine): ReactorException - collection of SourceException and InferenceException that happened during parsing. SourceException - problem itself is in YANG source |
| Comment by Igor Foltin [ 11/Jan/16 ] |
|
Fix pushed: |