diff --git a/java/jsinterop/generator/closure/ClosureJsInteropGenerator.java b/java/jsinterop/generator/closure/ClosureJsInteropGenerator.java index 7cf8cec..12fdb54 100644 --- a/java/jsinterop/generator/closure/ClosureJsInteropGenerator.java +++ b/java/jsinterop/generator/closure/ClosureJsInteropGenerator.java @@ -121,6 +121,9 @@ private Program generateJavaProgram() { .build(); compiler.compile(new ArrayList<>(), allSources, createCompilerOptions()); + if (compiler.getErrorCount() > 0) { + throw new GeneratorFailedException(); + } GenerationContext ctx = GenerationContext.builder() diff --git a/java/jsinterop/generator/closure/GeneratorFailedException.java b/java/jsinterop/generator/closure/GeneratorFailedException.java new file mode 100644 index 0000000..f8b853f --- /dev/null +++ b/java/jsinterop/generator/closure/GeneratorFailedException.java @@ -0,0 +1,6 @@ +package jsinterop.generator.closure; + +public class GeneratorFailedException + extends RuntimeException +{ +} diff --git a/java/jsinterop/generator/closure/Runner.java b/java/jsinterop/generator/closure/Runner.java index 0c6793b..6522742 100644 --- a/java/jsinterop/generator/closure/Runner.java +++ b/java/jsinterop/generator/closure/Runner.java @@ -123,6 +123,10 @@ public static void main(String[] args) throws CmdLineException { Runner runner = new Runner(); CmdLineParser parser = new CmdLineParser(runner); parser.parseArgument(args); - runner.run(); + try { + runner.run(); + } catch (GeneratorFailedException ignored) { + System.exit(1); + } } }