Skip to content
Snippets Groups Projects
Commit 17c68d3b authored by dgelessus's avatar dgelessus
Browse files

Display a nicer error message if no source code info is available

parent d70d013d
No related branches found
No related tags found
No related merge requests found
...@@ -310,6 +310,10 @@ public final class ProBKernel extends BaseKernel { ...@@ -310,6 +310,10 @@ public final class ProBKernel extends BaseKernel {
} }
private @NotNull List<@NotNull String> formatErrorSource(final @NotNull List<@NotNull String> sourceLines, final @NotNull ErrorItem.Location location) { private @NotNull List<@NotNull String> formatErrorSource(final @NotNull List<@NotNull String> sourceLines, final @NotNull ErrorItem.Location location) {
if (sourceLines.isEmpty()) {
return Collections.singletonList(this.errorStyler.primary("// Source code not known"));
}
final List<String> out = new ArrayList<>(); final List<String> out = new ArrayList<>();
if (location.getStartLine() < 1 || location.getStartLine() > sourceLines.size()) { if (location.getStartLine() < 1 || location.getStartLine() > sourceLines.size()) {
out.add(this.errorStyler.secondary(String.format("Error start line %d out of bounds (1..%d)", location.getStartLine(), sourceLines.size()))); out.add(this.errorStyler.secondary(String.format("Error start line %d out of bounds (1..%d)", location.getStartLine(), sourceLines.size())));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment