Skip to content

Commit

Permalink
Surface parser issues reported by the community (#684)
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek authored Dec 11, 2023
1 parent 4e7f59b commit d1b68cd
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.jetbrains.annotations.NotNull;
import org.openrewrite.ExecutionContext;
import org.openrewrite.ParseExceptionResult;
import org.openrewrite.SourceFile;
import org.openrewrite.internal.StringUtils;
import org.openrewrite.internal.lang.Nullable;
Expand Down Expand Up @@ -232,6 +233,9 @@ private SourceFile logParseErrors(SourceFile source) {
(mavenSession.getRequest().isShowErrors() ? "" : ", run with --errors to see full stack traces"));
}
logger.warn("There were problems parsing " + source.getSourcePath());
if (mavenSession.getRequest().isShowErrors()) {
source.getMarkers().findFirst(ParseExceptionResult.class).map(ParseExceptionResult::getMessage).ifPresent(logger::warn);
}
}
return source;
}
Expand Down

0 comments on commit d1b68cd

Please sign in to comment.