Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[improvement] Helpful error output is provided when formatting fails (#…
…366) ## Before this PR ``` java.lang.RuntimeException: com.google.googlejavaformat.java.FormatterException: 5:15: error: ';' expected at com.palantir.conjure.java.util.Goethe.formatAndEmit(Goethe.java:55) at com.palantir.conjure.java.util.GoetheTest.testFormatAndEmit(GoetheTest.java:38) Caused by: com.google.googlejavaformat.java.FormatterException: 5:15: error: ';' expected at com.google.googlejavaformat.java.FormatterException.fromJavacDiagnostics(FormatterException.java:50) at com.google.googlejavaformat.java.Formatter.format(Formatter.java:151) at com.google.googlejavaformat.java.Formatter.getFormatReplacements(Formatter.java:258) at com.google.googlejavaformat.java.Formatter.formatSource(Formatter.java:234) at com.google.googlejavaformat.java.Formatter.formatSource(Formatter.java:202) at com.google.googlejavaformat.java.Formatter.formatSource(Formatter.java:189) at com.palantir.conjure.java.util.Goethe.formatAndEmit(Goethe.java:52) ... 25 more ``` ## After this PR ``` java.lang.RuntimeException: Failed to format 'com.palantir.foo.Foo' ';' expected type oops name = bar; ^ at com.palantir.conjure.java.util.Goethe.formatAndEmit(Goethe.java:55) at com.palantir.conjure.java.util.GoetheTest.testFormatAndEmit(GoetheTest.java:38) Caused by: com.google.googlejavaformat.java.FormatterException: 5:15: error: ';' expected at com.google.googlejavaformat.java.FormatterException.fromJavacDiagnostics(FormatterException.java:50) at com.google.googlejavaformat.java.Formatter.format(Formatter.java:151) at com.google.googlejavaformat.java.Formatter.getFormatReplacements(Formatter.java:258) at com.google.googlejavaformat.java.Formatter.formatSource(Formatter.java:234) at com.google.googlejavaformat.java.Formatter.formatSource(Formatter.java:202) at com.google.googlejavaformat.java.Formatter.formatSource(Formatter.java:189) at com.palantir.conjure.java.util.Goethe.formatAndEmit(Goethe.java:52) ... 25 more ``` ==COMMIT_MSG== Helpful error output is provided when formatting fails ==COMMIT_MSG=
- Loading branch information