IOExceptions are unexpected and result in an IllegalStateException,
while LeafRefYangSyntaxErrorException indicates an inconsistent
schema context, hence results in an IllegalArgumentException.
Change-Id: I5282dc964f64af7a46794e3a02e219358fd95285
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
public static LeafRefContext create(final SchemaContext ctx) {
try {
return new LeafRefContextTreeBuilder(ctx).buildLeafRefContextTree();
- } catch (IOException | LeafRefYangSyntaxErrorException e) {
- throw new RuntimeException(e);
+ } catch (LeafRefYangSyntaxErrorException e) {
+ throw new IllegalArgumentException(e);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
}
}