private static String getMessage(Source source, int indexInSource, Throwable cause) {
return cause.getMessage() + "\n" + getMessage(source, indexInSource);
}
private static String getMessage(Source source, int indexInSource) {
SourceLine sourceLine = source.getSourceLine(indexInSource);
return "Error in " + source.getType() + " \"" + source.getName() + "\", row " + sourceLine.getRow() +
", column " + sourceLine.getColumn() + ":\n" +
sourceLine.getLine() + "\n" +
sourceLine.getCursor() + "\n";
}