Skip to content
Snippets Groups Projects
Commit 2ec727b3 authored by Paolo Guagliardo's avatar Paolo Guagliardo
Browse files

Return non-zero exit code on error in batch mode (closes #12)

A return code of 1 signals a SchemaException, which is useful to detect syntax
or validation errors.
parent 347d95bb
No related branches found
No related tags found
No related merge requests found
......@@ -450,14 +450,23 @@ public final class CommandLineApp {
} catch (SchemaException e) {
System.err.println(String.format("ERROR: In \"%s\": %s", e.getExpression(), e.getMessage()));
System.err.flush();
if (batch == true) {
System.exit(1);
}
continue mainLoop;
} catch (IllegalStateException e) {
System.err.println(String.format("ERROR: In \"%s\": %s", expr, e.getMessage()));
System.err.flush();
if (batch == true) {
System.exit(-1);
}
continue mainLoop;
} catch (Exception e) {
e.printStackTrace();
System.err.flush();
if (batch == true) {
System.exit(-1);
}
continue mainLoop;
}
} while (batch == false);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment