+ private SomeModifiersUnresolvedException addSourceExceptions(final SomeModifiersUnresolvedException buildFailure,
+ final List<SourceSpecificContext> sourcesToProgress) {
+ boolean addedCause = false;
+ for (SourceSpecificContext failedSource : sourcesToProgress) {
+ final SourceException sourceEx = failedSource.failModifiers(currentPhase);
+
+ // Workaround for broken logging implementations which ignore suppressed exceptions
+ Throwable cause = sourceEx.getCause() != null ? sourceEx.getCause() : sourceEx;
+ if (LOG.isDebugEnabled()) {
+ LOG.error("Failed to parse YANG from source {}", failedSource, sourceEx);
+ } else {
+ LOG.error("Failed to parse YANG from source {}: {}", failedSource, cause.getMessage());
+ }
+
+ final Throwable[] suppressed = sourceEx.getSuppressed();
+ if (suppressed.length > 0) {
+ LOG.error("{} additional errors reported:", suppressed.length);
+
+ int i = 1;
+ for (Throwable t : suppressed) {
+ // FIXME: this should be configured in the appender, really
+ if (LOG.isDebugEnabled()) {
+ LOG.error("Error {}: {}", i, t.getMessage(), t);
+ } else {
+ LOG.error("Error {}: {}", i, t.getMessage());
+ }
+
+ i++;
+ }
+ }
+
+ if (!addedCause) {
+ addedCause = true;
+ buildFailure.initCause(sourceEx);
+ } else {
+ buildFailure.addSuppressed(sourceEx);
+ }
+ }
+ return buildFailure;
+ }
+