Skip to content

Commit 9b00e2e

Browse files
committed
Log the line and column where parsing errors occurred.
1 parent 4155005 commit 9b00e2e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/guideme/compiler/PageCompiler.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,13 @@ public static ParsedGuidePage parse(String sourcePack, String language, Resource
155155
try {
156156
astRoot = MdAst.fromMarkdown(pageContent, options);
157157
} catch (ParseException e) {
158+
var position = "";
159+
if (e.getFrom() != null) {
160+
position = " at line " + e.getFrom().line() + " column " + e.getFrom().column();
161+
}
158162
var errorMessage = String.format(Locale.ROOT,
159-
"Failed to parse GuideME page %s (lang: %s) from resource pack %s",
160-
id, language, sourcePack);
163+
"Failed to parse GuideME page %s (lang: %s)%s from resource pack %s",
164+
id, language, position, sourcePack);
161165
LOG.error("{}", errorMessage, e);
162166
astRoot = buildErrorPage(errorMessage + ": \n" + e);
163167
}

0 commit comments

Comments
 (0)