Tweak DSL error formatting

- Add a blank line between the DslFilesException stack trace and
   formatted error messages.
 - Quote the sub-function name in the message for UndefinedSubFunction
   errors.
This commit is contained in:
Riccardo Azzolini 2019-08-12 13:50:18 +02:00
parent fbb6cf590d
commit 082f694b1b
2 changed files with 2 additions and 1 deletions

View File

@ -41,6 +41,7 @@ public class RulesManager {
} catch (IOException | DslFilesException e) {
e.printStackTrace();
if (e instanceof DslFilesException) {
System.err.println();
System.err.print(((DslFilesException) e).format());
}
Engine.getPlatform().exit(1);

View File

@ -31,7 +31,7 @@ public class DslErrorMessageFormatter implements DslError.Visitor<String> {
@Override
public String visit(final UndefinedSubFunction undefinedSubFunction) {
return String.format(
"Sub-function %s is used in a replacement pattern,\nbut not defined in the target pattern",
"Sub-function \"%s\" is used in a replacement pattern,\nbut not defined in the target pattern",
undefinedSubFunction.getName()
);
}