Skip to content

Commit 8b9f715

Browse files
committed
#6, workaround for missing log messages
1 parent a9b3c7b commit 8b9f715

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

src/main/groovy/io/openapiprocessor/gradle/OpenApiProcessorWorker.java

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,28 @@ public void execute () {
2121
Object processor = getProcessor (getProcessorName ());
2222
Map<String, ?> properties = getProcessorProperties ();
2323

24-
if (processor instanceof io.openapiprocessor.api.v1.OpenApiProcessor) {
25-
run ((io.openapiprocessor.api.v1.OpenApiProcessor) processor, properties);
24+
try {
25+
if (processor instanceof io.openapiprocessor.api.v1.OpenApiProcessor) {
26+
run ((io.openapiprocessor.api.v1.OpenApiProcessor) processor, properties);
2627

27-
} else if (processor instanceof io.openapiprocessor.api.OpenApiProcessor) {
28-
run ((io.openapiprocessor.api.OpenApiProcessor) processor, properties);
28+
} else if (processor instanceof io.openapiprocessor.api.OpenApiProcessor) {
29+
run ((io.openapiprocessor.api.OpenApiProcessor) processor, properties);
2930

30-
} else if (processor instanceof com.github.hauner.openapi.api.OpenApiProcessor) {
31-
run((com.github.hauner.openapi.api.OpenApiProcessor) processor, properties);
31+
} else if (processor instanceof com.github.hauner.openapi.api.OpenApiProcessor) {
32+
run ((com.github.hauner.openapi.api.OpenApiProcessor) processor, properties);
33+
}
34+
} catch (Throwable t) {
35+
waitForLogging ();
36+
throw t;
37+
}
38+
}
39+
40+
private static void waitForLogging () {
41+
// without waiting gradle does not reliably log a processor error/exception.
42+
try {
43+
Thread.sleep (1000);
44+
} catch (InterruptedException e) {
45+
throw new RuntimeException (e);
3246
}
3347
}
3448

0 commit comments

Comments
 (0)