Skip to content

Commit

Permalink
fix(#3374): unphi better errors logging
Browse files Browse the repository at this point in the history
  • Loading branch information
maxonfjvipon committed Sep 17, 2024
1 parent bd4123e commit 6d678ba
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions eo-maven-plugin/src/main/java/org/eolang/maven/UnphiMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public final class UnphiMojo extends SafeMojo {

@Override
public void exec() {
final List<Path> errors = new ListOf<>();
final List<String> errors = new ListOf<>();
final Home home = new HmBase(this.unphiOutputDir);
final Iterable<Directive> metas = new UnphiMojo.Metas(this.unphiMetas);
final int count = new SumOf(
Expand All @@ -119,7 +119,7 @@ public void exec() {
String.format(".%s", TranspileMojo.EXT)
)
);
final XML result = TRANSFORMATIONS.pass(
final XML result = UnphiMojo.TRANSFORMATIONS.pass(
new PhiSyntax(
phi.getFileName().toString().replace(".phi", ""),
new TextOf(phi),
Expand All @@ -133,7 +133,13 @@ public void exec() {
phi, this.unphiOutputDir.toPath().resolve(xmir)
);
if (result.nodes("//errors[count(error)=0]").isEmpty()) {
errors.add(relative);
errors.add(
String.format(
"%s:\n\t%s\n",
relative,
String.join("\n\t", result.xpath("//errors/error/text()"))
)
);
}
return 1;
},
Expand All @@ -145,9 +151,9 @@ public void exec() {
if (!errors.isEmpty()) {
throw new IllegalStateException(
String.format(
"%d files with parsing errors were found: %s",
"%d files with parsing errors were found:\n%s",
errors.size(),
Arrays.toString(errors.toArray())
String.join("\n", errors)
)
);
}
Expand Down

0 comments on commit 6d678ba

Please sign in to comment.