Skip to content

Commit 9d0657f

Browse files
committed
also fail on any exception
1 parent 7ae8da1 commit 9d0657f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/java/org/springdoc/maven/plugin/SpringDocMojo.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public class SpringDocMojo extends AbstractMojo {
104104
*/
105105
private static final String GET = "GET";
106106

107-
public void execute() {
107+
public void execute() throws MojoFailureException {
108108
if (skip) {
109109
getLog().info("Skip execution as per configuration");
110110
return;
@@ -121,7 +121,7 @@ public void execute() {
121121
Files.write(Paths.get(outputDir.getAbsolutePath() + "/" + outputFileName), result.getBytes(StandardCharsets.UTF_8));
122122
if (attachArtifact) addArtifactToMaven();
123123
} else {
124-
String message = "An error has occurred: Response code " + responseCode;
124+
String message = "An error has occurred, response code: " + responseCode;
125125
if(failOnError) {
126126
throw new MojoFailureException(message);
127127
} else {
@@ -130,6 +130,9 @@ public void execute() {
130130
}
131131
} catch (Exception e) {
132132
getLog().error("An error has occurred", e);
133+
if(failOnError) {
134+
throw new MojoFailureException("An error has occurred: " + e.getMessage());
135+
}
133136
}
134137
}
135138

0 commit comments

Comments
 (0)