Discern exceptions when building LeafRefContext
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / leafref / LeafRefContext.java
index 0e403563129e847a73f7e0daa5933368e4329d0c..7c0572049336a30e61ad74fa7b20084a5bb0cb37 100644 (file)
@@ -51,8 +51,10 @@ public final class LeafRefContext {
     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);
         }
     }