Add/improve yang parser error reporting
[yangtools.git] / yang / yang-maven-plugin / src / main / java / org / opendaylight / yangtools / yang2sources / plugin / YangToSourcesProcessor.java
index ccbbc3c4d7c843803263525d7496bdb82c627931..195c7f39ba2c43da6220827b81e3d975a3c24915 100644 (file)
@@ -11,6 +11,7 @@ import java.util.HashSet;
 import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
 import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Throwables;
 import com.google.common.collect.Maps;
 import java.io.Closeable;
 import java.io.File;
@@ -185,8 +186,9 @@ class YangToSourcesProcessor {
             // MojoExecutionException is thrown since execution cannot continue
         } catch (Exception e) {
             LOG.error("{} Unable to parse {} files from {}", LOG_PREFIX, Util.YANG_SUFFIX, yangFilesRootDir, e);
+            Throwable rootCause = Throwables.getRootCause(e);
             throw new MojoExecutionException(LOG_PREFIX + " Unable to parse " + Util.YANG_SUFFIX + " files from " +
-                    yangFilesRootDir, e);
+                    yangFilesRootDir, rootCause);
         }
     }